That's a common misconception. In most jurisdictions retailers can set their own payment policies.
It's a tremendous pain for retailers to accept cash, which is why they're willing to accept high transaction fees from online points of sale.