As is so often the case with law, it's all about interpretation.
American courts take a variety of approaches to reading statutes. Sometimes, courts look only at the text of the statute. And sometimes, they go beyond the text, and consult such sources as the intentions of the legislature, the purpose of the law, or decisions in earlier cases.
Here are some of the ways these approaches have been used to interpret §5103:
1) Text: The justification to sticking to the words of the text is simple: The text is the law. It is what legislators voted on, and what citizens can read.
Focusing on text does not mean reading the text literally. As the architect of the new textualism, Justice Scalia, said: “A text should not be construed strictly, and it should not be construed leniently; it should be construed reasonably, to contain all that it fairly means.”
Here are some examples of how the words of §5103 have been read to limit the scope of the statute:
a) When the text says “all debts, public charges, taxes, and dues,” it means exactly that: debts, not rents, not purchases, and so on. Thus, both the Treasury and Federal Reserve claim "debts" do not mean ”payment for goods or services.”
b) Since §5103 does not provide any punishment for not accepting legal tender, it is merely defining legal tender.
c) The statute says nothing about the form of payment. A check is not a substitute for cash. It is, as one court put it, “a promise of payment in legal tender, upon presentation of the check to a bank.”
B) Intention of Congress: When Congress passes a statute, it intends the words to mean something. Statutes should be read in light of those intentions, real or imagined. For example, one court said:
"First of all, it strains logic that Congress would have intended the statute to preclude a payee from limiting the locations where certain types of cash payment may be made."
C) Purpose of the statute: In the United States, law must serve the public good, it must solve some public problem. When interpreting statutes, judges should further the public good by asking what problem the law is trying to solve. Any interpretation that does not help solve the problem, or creates more harm than good, does not serve the public good, and should be rejected.
Thus, one court said, “the absolute language of the legal tender statute is clearly modifiable by the necessary consideration of what is reasonable under the circumstances.”
Similarly, the IRS interprets §5103 as allowing it to accept cash only at some locations, so as to reduce embezzlement and other frauds.
D) Precedent & Practice: If the law can be interpreted in different ways, the courts should follow earlier interpretations so the law is stable. If the courts choose the wrong interpretation, legislatures can always pass a statute correcting the courts.
Many of the decisions in this area rely on precedent.
ADDED: Theories of statutory interpretation
As George points out in the comments, many would say that judges should not look beyond the words of the text when reading a statute. However, as a matter of fact, they do.
For more details about the approaches I discuss, see Sec II here for a short, relatively non-lawyer friendly discussion, and Sec I here for a longer, more academic lawyerly discussion.