So is TNG's entire plotline with Moriarty. One could argue that the Federation knew about the sentience of holograms long before the Voyager era, and actively encouraged their slavery despite their clear sentience.
In fact the final "solution" Picard & Data work out for Moriarty in TNG is pretty fucking evil if you think about it.
So, summary is that Moriarty is holding the Enterprise hostage (he's gained the command codes) in exchange for his freedom from the holodeck. Picard trades it for control of the Enterprise, and Moriarty and his love, the Countess, depart the Enterprise on a shuttle.
Unknown to Moriarty, Data and Picard had created a program within the program, allowing Moriarty to believe he had departed the holodeck despite actually remaining within it. Picard and Data then ended the program the moment the command lockouts were removed, and left the holodeck a few minutes later. Moriarty and the Countess Regina Barthalomew would spend the rest of their lives inside a memory module, unaware of their situation, for as far as they were concerned they had left the Enterprise to live their lives in the real world.