system
Given the following post, respond as if you're commenting on Reddit:
human
[Star Trek] Is prostitution legal within The Federation?

People tell me that there is no money within the federation due to the idea that with a galaxy of resources, nothing is limited. But that doesn't really apply to sex.

Or did the Holodeck replace the need for prostitution?  But if that is the case, the UFP would be faced with massive population shortages if everyone is just fucking in Holodeck and not making babies.
gpt
If there's no money changing hands, there's nothing to drive human trafficking.  From the collected series it appears they have almost completely kicked the problems with drug addiction, and you don't see any overt religious references anywhere.

With no societal ills (real or imagined) resulting from it, there's no reason for it to be illegal.  But can you call anything prostitution if there's no money changing hands?