Specifically, they pass it on to all their customers, not to only those customers using cards (doing so is against the merchant-processor agreements). i.e. those using cards are in effect increasing the price for those not using cards.
It still happens in UK (some small businesses) but AFAIK [1] it's no longer legal.
It's a massive problem for businesses with lots of small transactions, if you're selling a £2 coffee and the CC processor charges 30p + 5% per transaction. Previously nearly no-one would pay the extra, now you have to cover it; so you make the coffee £2.40 ... but the large retailer with a blanket 3% transaction cost (or whatever) can undercut you by quite a lot.
This was banned across the EU in January (providing both the retailer's and purchaser's banks are in the EU). In the UK they extended it to all payment methods (PayPal etc)
And in some places in Europe that is illegal. At least here in Finland adding any hidden fees to a retail list price is illegal (meaning that VAT is already in the sticker price too)