Actually it was touched on in a number of episodes (which i don't feel like digging up) but in more than once instance they mentioned that the replicators had safety systems that prevented unauthorized creation of at least some dangerous materials, (from what i recall, poisons were mentioned in one, weapons themselves i'm not sure).
TOS they made flintlock rifles in "Balance of Power"
TNG "Samaritain Snare" Geordi is kidnapped by technically unsophisticated, but cunning people that use replicators to reproduce high-tech (including a phasor)
istr a ds9 novel (yes, i read some) where they had to replicate some machine guns to deal with invaders who had perfect shielding, but only against energy weapons. there were security overrides involved, but it had a large collection of projectile weapons to choose from once it was unlocked.
A lot of things were "forbidden" by social pressures. Alcohol was freely available (or maybe a simple security override, I can't remember) but no one drank real alcohol.