The second mishnah in the third chapter of Maseches Megillah deals with the laws of selling a synagogue: even in a case where the sale is permitted, the Tannaim disagree about the manner and the conditions under which it may be sold, and for what uses the buyer may then use it.
The opinion of Rabbi Meir:
"Ein mochrin oso ela al tenai she'im yirtzu yachziruhu, divrei Rabbi Meir" - even when a synagogue is sold, it may not be sold in an outright sale, but only on condition that if the sellers wish, they may take it back. This condition expresses that they are not entirely at peace with the sale, and that they do not truly wish to part with the synagogue. There is a measure of affection for the synagogue in this.
The opinion of the Sages:
"Vachachamim omrim: mochrin oso mimkar olam" - the Sages disagree and hold that it may be sold in a permanent, outright sale, and there is no need to display this affection by means of a condition. The Sages do, however, add a qualification: "chutz me'arba'ah devarim" - four uses for which the synagogue may not be sold:
"l'merchatz" - it may not be used as a bathhouse.
"ul'vursaki" - a tannery, a place where hides are processed, which has an extremely foul odor.
"ul'tevilah" - a place used as a mikvah.
"ul'veis hamayim" - a place used as a lavatory.
Each one of these uses is unbefitting a synagogue.
The opinion of Rabbi Yehudah:
"Rabbi Yehudah omer: mochrin oso l'shem chatzer, v'halokeach mah sheyirtzeh ya'aseh" - Rabbi Yehudah is the most lenient of the opinions: the synagogue may not be sold for any other stated use, but only as a courtyard, that is, as a storeroom; yet once it has been sold, the buyer may do with it as he wishes. There is no connection between the purpose for which it was sold and what is actually done with it afterward, and that depends on the buyer.
In summary: in this mishnah the Tannaim disagree about the manner in which a synagogue is sold - Rabbi Meir requires a condition allowing it to be taken back, out of affection for the synagogue; the Sages permit a permanent sale, except for four uses that are unbefitting (a bathhouse, a tannery, an immersion site and a lavatory); and Rabbi Yehudah is lenient and permits selling it as a courtyard, with the buyer then doing with it as he wishes.