It used to be the case that the credit card companies put language in their merchant agreements language requiring the merchant to change the same price for credit and cash transactions. I'm not sure how many places they just lost the leverage to do that sort of thing and how many places enacted legislation to prevent that kind of strong-arming.
I’ve seen it occasionally too, but it’s usually a violation of a merchants’ agreement with Visa/MC, who don’t want consumers to be discouraged to pay with their product.
How I usually see this is instead of a surchage for credit card, stores offer a cash discount of 2-4%. Likely to get around exactly what you're talking about