From what I know of nerds, the Federation would need to have an entire corps of cops that specifically watch out for self-replicating replicators and home-made holodecks built without "safety" interlocks or content restrictions.
The Starfleet holodecks are just scarce because the operating code and hardware has to be formally validated and certified as safe for use in Starfleet vessels and installations. It's like how a GPS device is really cheap, until you want one permanently installed in an aircraft cockpit. Even then, malicious code (Moriarty, if I recall correctly) could break out of the holodeck sandbox and compromise connected systems.
The Starfleet holodecks are just scarce because the operating code and hardware has to be formally validated and certified as safe for use in Starfleet vessels and installations. It's like how a GPS device is really cheap, until you want one permanently installed in an aircraft cockpit. Even then, malicious code (Moriarty, if I recall correctly) could break out of the holodeck sandbox and compromise connected systems.