[. . .] if you can press a button and replicate anything, what’s to keep you from making gold, diamonds, or simply funny money? Nothing. This completely invalidates the economy from the bottom up. How? Well, the economy is based on supply and demand: something only has value if people want it.
[. . . ] The only things that a replicator cannot directly create on it’s own are the power it uses and the generic matter it uses to create things. [. . .] Hungry? Make a sandwich. Cold? Make a jacket, then make some tools and materials to build a shelter.
This does not take into account the power of the RIAA. In the future, Star Trek Replicators will have powerful DRM built in to prevent users from replicating copyrighted music CDs. So there will still be an economy based on those. In fact, the basic unit of intergalactic currency in the future will be the Metallica CD. And the replicator doesn't really threaten the World's Oldest Profession either. So the entire future economy could be one where people trade sexual favors for music CDs.
If the replicator were really all you needed, nobody would be willing to work at dangerous jobs like being red-shirt security officers for the Federation. They would quit their jobs and sit at home by the replicator, replicating crack just as fast as they could smoke it. Why do they bother serving in Star Fleet? Because they're getting paid in music CDs.