Until the consumer banking stuff passed under Obama you really had no choice but to participate. Card companies enforced merchant agreements which wouldn't let merchants charge people less for not using a card (though some states banned such agreements prior to the federal change).
Merchants would lose business if they didn't accept cards, and card companies were basically able to squeeze them until such loss of business was barely more painful than just going through with it.
A slight market correction came in the form of competition between card companies to give cash-back deals. This essentially rebated some of the fee back to the consumer (if an Ayn Rand nutjob saw a government bureaucratic scheme half as complex they would explode with anger).
People with cash couldn't opt out; they still had to pay the same as card users, but now those merchant agreements have been restricted by law.