The credit card companies do specify in their agreements that you are NOT allowed to pass this fee back to the consumer. Of course that is always done anyway, it just can’t be directly charged to the consumer. So it is baked into the prices, or recouped through some other, seemingly unrelated “convenience fee”, etc.
......................................
I was going to pay my property tax with a credit card until the county clerk told me there was a 3% fee for that. I only get 1.5% cash back from using the card so I paid in cash.
Yes, the actual fee that the county is charged is probably less, like 2.5% or something (it depends on the card), but they can’t charge you that because it is forbidden by the credit card merchant agreement. So they charge 3% and call it something else, but you’re the one paying either way.