I don’t think I can get cash back on my credit card at Walmart. I can do it on my debit card though.
You certainly can at an ATM, though. Pretty easy to max out your credit card on cash advances.
I think the idea was that if you have any cash in the first place, and a credit card, then if you can’t buy lottery tickets on credit you buy the food on credit and the lottery tickets with your cash, since you cannot do it the other way around. (Editorial “you”, obviously.)