That cash back is basically a scam. It's paid for by the credit card processing fees - fees which are charged to merchants and ultimately get passed on to the customer in the form of higher prices. Some merchants even tack on explicit ~$3 transaction fee for credit card purchases, to cover transaction costs.
So the cash back is just a partial refund on your credit card processing fees.