Passing on a unique credit card fee to customers used to be legally considered as discrimination. You could give discounts for cash, but you could not charge extra to take cards. CC companies put this through the courts years ago. Might still be...
It used to be like that but Government Agencies started taking Credit Cards and charging 3% to do so. It was ended then.
That “discrimination” was per the banking credit card cartel, looking to get their cut without allowing merchant to pass the cost on to customers who opted to use their products.
That is what got us this close to a cashless society—and acute social credit score control.