The first mention of rules in the Star Trek universe was in "The Nagus", an episode of the TV series Star Trek: Deep Space Nine (Season 1, Episode 10). In a later Deep Space Nine episode, "The Maquis: Part 1", Sakonna (a Vulcan) asks Quark (a Ferengi) to explain what a Rule of Acquisition is. He states, "Every Ferengi business transaction is governed by 285 Rules of Acquisition to ensure a fair and honest deal for all parties concerned... well most of them anyway."
The first Rule was made by Gint, the first Grand Nagus of the Ferengi Alliance, a role with political, economic, and even quasi-religious duties. The Rules were said to be divinely inspired and sacred (thus furthering the original marketing ploy.)
Although it has been stated within Star Trek that there are 285 Rules, not all of them have been stated in canon. Most of the Rules were written by Ira Steven Behr, a writer for Star Trek: Deep Space Nine, in a book The Ferengi Rules of Acquisition (ISBN 0-671-52936-6). The book's cover credits authorship as being "By Quark as told to Ira Steven Behr." Additional rules were published in Legends of the Ferengi (ISBN 0-671-00728-9) by Behr and Robert Hewitt Wolfe, another writer for Star Trek: Deep Space Nine when Behr was the executive producer of the series.
Unabridged and fully annotated with all 47 commentaries, all 900 major and minor judgments, all 10,000 considered opinions. There's a rule for every conceivable situation." There is also a note about The Unwritten Rule: "When no appropriate rule applies... make one up."