It's not simply a matter of the water bill, but also what culture it promotes around their service, what customers (or "customers" in quotes) this attracts, how this affects other actual customers and so on.
McDonald's have bought or rented the place, own the equipment, pay their staff, and pay taxes. They did all this to offer a specific service. You can take that service or leave it. They're not a public free water dispensers, or social services, or whatever role people are trying to impose on them.
I've given folks water when I worked in places that had such things, and most food places I've worked at - including McDonalds - gave folks water if they asked for it.
They aren't the only ones paying taxes, by the way. Not everyone who needs water are homeless, and a good deal of homeless folks
No one is discussing some hypothetical situation where someone knocks on your home, either.
We're talking about a problem that's systematic, at volume, and persistent over time, and therefore qualitative change for McDonald's and the environment they offer to customers.
McDonald's wanted to offer finite refills to paying customers. Their current system had a loophole with unintended consequences, so they closed that loophole.
If you want to help homeless people I guess go work at McDonald's and give homeless people water when they ask, and everything will be perfect. But let's see if your ideals stay intact after 10 cups of water. 100 cups of water. 1000 cups of water. A million cups of water.
It's very easy to say "oh I gave water to a dude once". I also gave water to a dude once, doesn't matter for McDonald's and people habitually coming back to leech a resource they provide that's not intended to be free in the first place.
And I've "let" homeless folks into places I work before and given folks water. The McDonalds I've worked at did not charge for water. I'll also mention that water fountains aren't all that useful during winter.