I suspect that's more or a contractual thing than a legal thing. I know gas stations around South Florida are now advertising cash and credit prices (so my thought is---the gas companies have enough pull to get favorable terms from the credit card companies).
To date it has been contractual. However, as a result of an antitrust lawsuit, Visa and Mastercard changed the provisions that ban merchants from charging a credit card surcharge. But states are now trying to bad adding those surcharges: http://www.cnbc.com/id/100485094.
Of course. I'm implicitly claiming that this kind of contractual requirement should be illegal since it's blatantly anticompetitive (my opinion, not the court's, naturally).