It's feels good to genuinely do something nice for another person and I wouldn't want to take that from them. It's also nice just knowing that not everyone in your community is only looking out for themselves. Might as well take the opportunity to do something for someone else
I've wanted to pay sometimes for people - but didn't have the courage... shame.
I tend to just try help out those who are having trouble paying, regardless who they are, on the condition that if we're in a supermarket, their shop is a grocery shop on the whole; if they're buying £70 worth of spirits and nothing else, I'm probably not going to offer.
I work in central London, so sometimes a tourist will come into my local cash-only coffee shop just in front of me and not have cash, so I'll just offer to buy their coffees or whatever, though there are no cash-only coffee shops now since returning to the office after the pandemic, so it doesn't happen as often.
But I think it's a good thing to do if you "hit" the correct "target".