Is that actually what he said?
From William James' "The Meaning of Truth: A Sequel to 'Pragmatism'" (1909 - page 104, boldface and italics my own):
This subjectivist interpretation of our position seems to follow from
my having happened to write (without supposing it necessary to explain
that I was treating of cognition solely on its subjective side) that
in the long run the true is the expedient in the way of our thinking,
much as the good is the expedient in the way of our behavior! Having
previously written that truth means 'agreement with reality,' and
insisted that the chief part of the expediency of any one opinion is
its agreement with the rest of acknowledged truth, I apprehended no
exclusively subjectivistic reading of my meaning. My mind was so
filled with the notion of objective reference that I never dreamed
that my hearers would let go of it; and the very last accusation I
expected was that in speaking of ideas and their satisfactions, I was
denying realities outside. My only wonder now is that critics should
have found so silly a personage as I must have seemed in their eyes,
worthy of explicit refutation.
...and the original from "Pragmatism" (1907 - see page 222)
'The true,' to put it very briefly, is only the expedient in the way
of our thinking, just as 'the right' is only the expedient in the way
of our behaving.
See here for an adequate interpretation:
By this, James meant that truth is a quality the value of which is
confirmed by its effectiveness when applying concepts to actual
practice (thus, "pragmatic"). James's pragmatic theory is a synthesis
of correspondence theory of truth and coherence theory of truth, with
an added dimension. Truth is verifiable to the extent that thoughts
and statements correspond with actual things, as well as "hangs
together," or coheres, fits as pieces of a puzzle might fit together,
and these are in turn verified by the observed results of the
application of an idea to actual practice. James said that "all true
processes must lead to the face of directly verifying sensible
experiences somewhere." He also extended his pragmatic theory well
beyond the scope of scientific verifiability, and even into the realm
of the mystical: "On pragmatic principles, if the hypothesis of God
works satisfactorily in the widest sense of the word, then it is
'true.'"
...and his writing is coherent considering a standard reading of the "expedient" as the "quality of being convenient and practical (despite possibly being improper or immoral)"
Considering this definition of expedient, note that James uses right and good interchangeably. I think he means them in more of a sense of "acceptable" or "justifiable" than "correct" in any absolute or pure sense.