This question already has an answer here:
Under the Treaty of Algeron, the Federation was banned from using cloaking technology without the explicit permission of the Romulans.
What caused the signing of the treaty? I can assume from a few links on the site that such a treaty was the result of a War, but I couldn't find much more than that.
So, Why are cloaked ships banned in the federation?