This is so much cheaper per dollar than people think. Certainly cheaper than credit card fees once you're over a certain volume, unless you are in a very high-crime area. Even then, thieves will often steal off the shelves instead of out of the cash register because that's a much smaller crime. Small businesses get the short end of the stick on cash management, again, because they may not be.
Eh, my experience is that dealing with cash is much more expensive than people think (to be fair, most people think it's "free" since there are no direct fees). At some places I've worked in the past, it's been like almost the only responsibility of a manager working full time. Making sure everything is in order, watch over workers, training them on all procedures, going to the bank to buy change, counting tills all the time, etc etc. Sooo many man hours going into this.
So many people overlook the cost of being able to "make change" an arbitrary amount of time with (nearly) arbitrary denominations.
Think about the last time you bought some for $1.27 and paid with a $20 and they took it without blinking.
I live in a developing country where there are still a ton of small mom & pop shops that aren't willing to eat the cost of that externality. So it isn't uncommon to go to one of them and they'll go "sorry, I can't make change for that bill size". Then you suddenly have the hassle of needing to drive to another store or getting change somewhere else or whatever.
In practice you adapt: the ATM only spits out big bills so you make a purchase somewhere to start breaking them up. Go buy a soda at an international chain instead of the local corner store. That kind of thing.
But it is still a cost we all pay, since "making change" isn't free.