There is an interesting article on Slate that started as a Quora post. Is the Star Trek economy a welfare state? It is an interesting discussion. I wonder myself, I think, at least by the time of Star Trek: TNG and Star Trek: DS9 it would be better called a post-scarcity society rather than a welfare state, but perhaps the ideal of the welfare state is the post scarcity society. Sadly we aren’t there yet.
In the Star Trek universe, most basic resources on Earth are essentially unlimited and are therefore distributed free of any cost or trade. The Federation has enough clean sources of energy that it will never use it all up, and it can make food, water, clothing, etc. from energy. So people who don’t work and just live off the free goods being provided aren’t parasites because the resources they’re using don’t drain the state. They’re not taking it from anyone; it’s just free. This would sort of be like saying: Are American citizens who don’t pay for the air they use parasites?
It’s also clear that there is still an economy of sorts on Earth and certain things are not free, although they are also not available for monetary purchase. Some things have to be limited in nature, so they can’t be available to everyone. This means that some kind of decision matrix must be applied regarding who gets them and who doesn’t, so that whatever qualities the eventual recipient has that resulted in them being awarded the good is essentially what they “paid” for the good.