So yeah. Housing the homeless is an effective solution. There are more empty homes than homeless in the US at least. And you can subsidize or build new places for this purpose, especially if they are transitory for the majority. And it'll still be cheaper than dealing with all the knock-on effects of homelessness: litter, crime, health issues, etc.
I think the problem has more to do with the fact that humans are common to fall into nepotism and greed. This is not a problem that is siloed to either economic solution. (https://www.history.com/news/ukrainian-famine-stalin)
This post was revised using the help of a locally run instance llama2-uncensored from https://ollama.ai/.