FWIW, I don’t think that’s quite correct. I think it’s a state level law. It’s illegal in most of the US but it is legal in some counties in NV. I don’t think there is any federal law relating to prostitution.
Wikipedia: "The regulation of prostitution in the country is not among the enumerated powers of the federal government. It is therefore exclusively the domain of the states to permit, prohibit, or otherwise regulate commercial sex under the Tenth Amendment to the United States Constitution, except insofar as Congress may regulate it as part of interstate commerce with laws such as the Mann Act. "