The till probably has under £500 in, probably less. The ATM probably 20 times that.
By offering cash back you're reducing the amount of cash kept in store, reducing the chance of being robbed (less worthwhile). By putting an ATM in store you're increasing the cash on premises, and in your tills (as people use the ATM rather than cash back)
Cash back is a win-win for stores.