(covers information from several alternate timelines)
"That treaty has kept us in peace for 60 years! And as a Starfleet Officer, you're supposed to uphold it."
The Treaty of Algeron was a peace treaty signed between the United Federation of Planets and the Romulan Star Empire in 2311, following the events of the Tomed Incident. The Treaty of Algeron was signed approximately 160 years after the conclusion of the Earth-Romulan War. (TNG: "The Pegasus")
The treaty reinforced and redefined the Romulan Neutral Zone, and made clear that any violations of the Zone without adequate notification, by either side, would be considered an act of war. (TNG: "The Defector"; ENT: "These Are the Voyages...") The treaty also expressly prohibited the development or use of cloaking device technology by the Federation. Then-Captain Pressman attempted to circumvent this clause in 2358 with the test of a phasing cloaking device developed covertly at least in some part by Starfleet Intelligence aboard the USS Pegasus. (TNG: "The Pegasus")
An exception to the treaty in 2371 allowed for the limited supervised use of at least one cloaking device on loan from the Romulans. Operation of the cloaking device was to be limited to the Gamma Quadrant. In return, the Romulans would receive all information the Federation obtained on the USS Defiant's voyages into the Gamma Quadrant, most importantly any information concerning the Dominion. As such, the Defiant was the only Federation ship to be permanently equipped with a cloaking device. (DS9: "The Search, Part I", "Visionary") However, Captain Benjamin Sisko and his crew violated this amendment on several occasions by using the cloaking device in the Alpha Quadrant. (DS9: "The Way of the Warrior", et al)
In Q's anti-time future, the Federation possessed and openly used cloaking technology. The Romulan Empire had been conquered by the Klingon Empire, which presumably nullified the Treaty. (TNG: "All Good Things...")
In the video game Star Trek: The Next Generation - A Final Unity, the Treaty has a provision allowing entry into the Neutral Zone for scientific or archeological purposes, which the Enterprise-D exploited to investigate a Chodak planet. Tomalak also appears to reference this provision in TNG: "The Defector"
In the video game Star Trek Online, set in 2409/10, the Romulan Star Empire collapsed due to the destruction of Romulus. The in-game lore  however states that the elected president of the United Federation of Planets, Aennik Okeg, proclaimed that the UFP and Starfleet are still bound to the contents of that treaty and all efforts concerning the research and/or developing of cloaking technology have been banned within the UFP (The Path to 2409: Volume 16, Chapter 2). This statement was a reaction to the exposed illegal attempts of Starfleet Security to develop cloaking technology of their own when the USS Kelso, fitted with a prototype cloaking device, was lost with all hands on Stardate 72487.91 due to a critical malfunction (The Path to 2409: Volume 16, Chapter 1).
Contrary to the games' own lore, Federation players are able to choose eight ships with cloaking technology, the Galaxy-class Refit (named "Dreadnought Cruiser" in-game) as seen in "All Good Things...", a retrofit of the Defiant-class, Avenger-class battlecruiser, Intel Ships (Phantom, Eclipse, and Scryer), Arbiter, and the Yamato class, which is specifically designed to compete with comparable Klingon vessels. Non-player controlled (NPC) versions of those ships however do not show cloaking capability.
In the video game Star Trek: Invasion, the Valkyrie class Federation fighter craft are equipped with cloaking devices.