Justice is a really laughable episode, but it seems like those people had been contacted before and were some sort of "resort planet." There are plenty of episodes where they deal with less advanced races but have rules about what they can give them because of the Prime Directive. We don't know how the contact was originally established with the Aryan Superman Sex Resort people.
From the Tor.com discussion of that episode
The Prime Directive in this episode is definitely more along the TOS lines ó contact is okay, sharing technology or influencing a culture is not. If youíre the type of Trekkie who likes to rationalize inconsistencies (I am) you can explain this away. Not everybody has the Prime Directive, so a lot of pre-warp cultures have probably been contacted by non-Federation aliens. This would be more true during the TOS era when the Federation is smaller and its influence isnít as great. So there would be two types of pre-warp planets ó the kind you can contact because they already know aliens exist, and the type you canít contact because they donít.
It still seems very irresponsible to go there for shore leave, especially without understanding their laws. It should probably be a Prime Directive violation to go on leave to a primitive planet without having a sufficient understanding of their customs.