Actually, we have. DS9's "Inter Arma Enim Silent leges" established that the Federation Charter bans the UFP government from interfering in the internal affairs of foreign cultures.
There a Human from the Federation was going to manipulate the selection of one Romulan (over another) for a political position.
The Federation Charter forbids interfering in the internal affairs of a sovereign state. Which isn't the same as forbidding all interaction. Trade, finance, tourism, education, social discourse could all be neither allowed nor disallowed by that portion of the Charter. Even a certain amount of external political advocacy could be completely kosher.
What constitutes "internal affairs?" And does the prohibition specifically refer to steering clear of a foreign government's operation? But outside of that, most other things in that foreign "land" are fine ... up to a point (covered by different prohibitions).
I don't believe that was mentioned.
Not only would there be primitives who'd pay good alcohol or pergium for electric razors and other trinkets - there would be the potential for meeting advanced civilizations that might accidentally sell something of great value in the regular market.
And who knows when some ultra low-tech culture is going to introduce you to the next chocolate, or maize, or tobacco?
... civilians ...that prevents them from setting up shop as gods on primitive backwoods planets?
Even with a law against it in place, what would prevent them? Consider how low the odds are of being discovered.