Before this law in the UK it was mostly small businesses (e.g. local independent grocery stores) charging 50p per transaction. I think the law was probably to encourage uptake of contactless payments which are targeted at these small transactions.
It's still legal here to have a minimum transaction value for paying with card, which some businesses use. But since the pandemic it's become more common to find businesses that don't accept cash than the other way around.