If they tell you after giving you a ride that you have to go to an ATM and pay the ATM fee, then they are just passing the cost on to you at a net loss - ATM fees are higher than CC fees on purchases the size of a typical cab fare. I'm not convinced that it's better to funnel money to banks rather than CC companies.
If you're paying ATM fees a) that's on the banks, not on the cab driver, and b) you need to switch banks--I have paid a handful of ATM fees in the last decade and I make in-person purchases almost exclusively in cash.
If there's no bank you have an account at within a reasonable distance, you might not have a choice. Obviously I use free ATMs when I can, but how much control do you have when a cabbie is demanding money?
I moved a year ago so there isn't a bank I have an account at in my current state. But my bank is part of a national network of ATMs. If I use an out-of-network ATM the fee is refunded up to once a month.