Many banks reimburse some number of (or unlimited!) ATM fees per month from out of network machines.
Candy bars at convenience stores are frequently less than the cost of an ATM fee.
Therefor, it could be beneficial to customers for banks to instead let them use their debit card to purchase a candy bar plus get cash back, and then reimburse them for the candy bar.
Same cost or less for the bank, free candy bar for the customer!