Three comments there. (And the tragedy of the commons is a fairly high level concept, so this post will be fairly abstract, without the sort of concrete solutions that have been discussed above.)What do you think about "The Tragedy of the Commons" as it applies to this type of situation?
One, of course there will be people who take advantage of it - which is by definition the tragedy of the commons. Since no one person pays for the commons (the various homeless-support programs) there is less desire to preserve the grass in the commons (i.e. conserve the resources available for the homeless, and use them sparingly.)
Two, at a slightly higher level, I think we realize that any such solution is not going to be 100% efficient. There will be people who take advantage of any system, no matter how well policed, and there will be people who are not helped by the system, no matter how freely available those services are. The goal is to trade those two off against each other.
Three is that with the homeless, we are entering the realm that Joshua Greene calls "the tragedy of commonsense morality." His premise is that if we still lived in tribes - groups of 20 to 500 people - there wouldn't be a homeless problem. If there are 500 people in your tribe you are going to know them all, and if someone is homeless for whatever reason, they are taken in. Evolution equipped us with these responses; it made living in communities possible. Like my example of the janitor above - his family takes him in, and he is cared for. We are wired for that, to show compassion and forgiveness for people close to us (those in our "tribe.")
But that starts to break down in larger groups. Over population groups of millions of people, and over continental differences, we just don't care that much - and often find reasons to hate and fear those other faraway tribes. Evolution also equipped us with these fears, since foreign tribes encroaching into our areas are a real threat if you are living off the land.
There are a few famous thought experiments to demonstrate this. Would you jump in the water and ruin a $1000 suit to save a drowning child? Of course you would. Would you sell that $1000 suit and save the lives of two children in sub-Saharan Africa with that money? Ask anyone and their replies will likely be along the lines of "well, I do what I can . . . you know there's a lot of starving kids . . . I really do need a suit if I am going to make a good impression with my clients . . . I donate at church you know . . ." That's those mechanisms again, valuing the life of a nearby child far more than the life of a child 8000 miles away you have never seen.
Would you throw the switch in the famous trolley problem, and sacrifice one to save five? Ask that and you will have a good discussion. However, modify that a little. Will you push the unsuspecting fat man next to you onto the tracks to derail the trolley, thus saving those five people? And here again, most people will say no, that's murder, I wouldn't want someone to do that to me etc etc. By positing the killing of someone near to you - someone you can see, who can react to your actions, who might be part of your tribe - the answers change dramatically. Of course you save the person near you even if five people far away die. Let them save themselves. After all, they are them, not this guy standing next to me.
As we have moved from tribes to societies to city-states to countries, we have kept this "support my tribe and let that other tribe go to hell for all I care" approach to things. Leaders capitalize on this; it's called patriotism when applied to an entire country, with xenophobia being the converse when applied to others. I am sure I don't have to give examples of both approaches in our global society.
And it's easy to expand that xenophobia to others even within our own society. We have seen it with democrats vs republicans, natives vs immigrants, Christians vs Muslims, black vs white etc. And once again, politicans find those natural responses and amplify them for the power that gives them over people.
And it happens naturally with the homeless as well. "They" are lazy. "They" are mentally ill. "They" caused their own problems. "They" are not like me or my tribe and so helping them is not my job. (Note - not saying you do this, but that is often the messaging we see in media and politics.)
So one solution is to wave a magic wand and expand those natural tribal protections we feel for our tribe to the whole world. Not going to happen, of course, outside of a few people who really seem to feel that way.
Another solution - Greene's solution - is to consciously disregard those messages our lower brains are giving us and switch to what he calls "manual mode", a mode where we ignore those drives that evolution provides for us and use a more objective approach. He advocates for utilitarianism, which is a pretty simple approach that states that one should act to maximize goodness and minimize badness both for oneself and for others. Those extremes are generally defined as happiness vs unhappiness, eating vs starving, pleasure vs pain etc etc. It doesn't always give you the right answer immediately (i.e. should you give the drunk another drink even if it makes him momentarily happy?) but it does provide a framework for deciding what to do.
And for the case of the homeless, utilitarianism would suggest that we spend as much money as we need to to help the most people we can, right up until the point that the amount of money we spend starts causing other people to starve, to become homeless etc. This is going to rub a lot of people the wrong way, because why should they be 'penalized' (taxed) to take care of those not-my-tribe people who are too lazy to work? That's where Greene would advise shutting down that tribal response and instead thinking more objectively about the best way to reduce unhappiness and pain for everyone. Even if it takes a toll on the commons.