Cash transactions have real costs including employee theft and risk of being robbed both holding it and transportation.
https://sbecouncil.org/2024/07/01/the-cost-of-cash/
People also spend more when using credit cards where it is a net benefit to merchants.