According to the answers on Can a merchant charge you more in the US if you want to use a credit card?, I gather that, while it is not illegal for a merchant to pass their payment card processing fees on to their customers directly in the form of a surcharge, doing so is a violation of their merchant agreements with the payment card processor (at least for Visa/MC).
There are workarounds available to the merchants, such as offering a cash discount, or setting a minimum purchase amount for cards, but if the merchant is not using such a workaround (in my experience, many don't), what's the best way to get them to process my transaction without applying the fee, or alternatively, penalize them for applying the fee?
JoeTaxpayer helpfully points out that merchants can now impose a surcharge in most states, subject to certain conditions, including signage at both point of entry and point of sale. This question is asked in the context of a merchant that fails to comply with these or other applicable requirements.
Please also note that "Don't patronize those merchants" isn't the kind of answer I'm looking for here. If the merchant were properly complying with all of the conditions under which they can impose a surcharge, that would be the only recourse, but I am interested in answers for the specific case of a noncompliant merchant.
Here are two actual examples from my personal experience. In neither of these cases was I successful in either compelling the merchant to complete the transaction without imposing the surcharge, or in causing a direct repercussion to the merchant sufficient to induce them to discontinue the practice.
A local pizza place would add an additional $0.50 charge for purchases made by credit card. I was aware of this practice, and I had also read that Visa and MasterCard both prohibit it. When I went in to pick up my pizza, they asked if it would be cash or credit. Before answering, I asked "What's the total?" They quoted me an amount equal to the menu price plus sales tax if I paid cash, and stated that if I used a credit card it would be an extra 50 cents. I told the cashier that this was not allowed, but the cashier indicated it was not up to them. They stated that most of their customers just paid in cash. They were busy, I was hungry, and I had no cash on me, so rather than continue to press the issue, I asked the cashier to be sure that my receipt clearly distinguishes the amount of the fee and identifies it as a surcharge specifically imposed because I paid with my card. She handwrote "CC" next to the 50 cent line item, and I left with my food and put the receipt somewhere so it wouldn't get lost, telling myself that I would contact Visa about it (I never did, and I lost the receipt anyway).
I stopped at a convenience store on my way to the disc golf course to buy two bottles of Gatorade. The cashier (I think he was also the owner) scanned them and read me the total. I held out my credit card and he said "Oh, there's a 35 cent fee with that." I replied "No, I do not agree to that." He stated that the store incurs a cost every time they process a credit card transaction, and something about margins. I responded along the lines of "I don't really care what your margins are. Those fees are a cost of doing business, and Visa and MasterCard both explicitly prohibit you from charging me extra to use my card." However, he did not change his position. I left the bottles on the counter and walked across the street to his competitor, and as far as I know, he still charges that fee.
UPDATE: As it happens, both of these shops went out of business, even though I never did follow up personally with the payment processors about them.