Merchant agreements usually prevent credit card surcharges.
Most companies get around it by offering a cash discount, which the merchant agreements allow. In the end it's the same thing, you pay less if you are using cash or check then you do with a credit card. But the merchant agreements have never been changed to prevent it.
The truth in lending law preventing surcharges expired over 20 years ago, but since then the following states have enacted laws preventing it:
California
Colorado
Connecticut
Florida
Kansas
Maine
Massachusetts
New York
Oklahoma
Texas.
If you aren't in those states, and it was a credit card surcharge, and not a cash discount (which is virtually impossible to show, as they are the same), then you could take it up with the credit card company, but it won't get you the same cash price, and probably won't get anywhere.
Merchant agreements are pretty much a joke, everybody ignores the no minimum charge, no surcharges, etc. Merchants know that unless they are huge and get a ton of complaints against them, they usually won't be in hot water.