Megillah, Chapter Three, Mishnah Two
This mishnah deals specifically with selling a synagogue.
1) They may not sell a synagogue except with the stipulation that it may be bought back whenever they want, the words of Rabbi Meir.
2) But the sages say: they may sell it in perpetuity, except for four purposes for it to become one of four things: a bathhouse, a tannery, a ritual bath, or a urinal.
3) Rabbi Judah says: they may sell it to be a courtyard, and the purchaser may do what he likes with it.
Section one: Rabbi Meir holds that the community can sell the synagogue but only on condition that the synagogue can be bought back any time they wish. It sounds like Rabbi Meir intends to say that while the community may sell the synagogue because they need to buy holier items, what the community should really do is save up so that they can buy the synagogue back. Also, if they saw that the synagogue was being put to improper use, they could demand to purchase it back immediately.
Section two: The rabbis are more lenient when it comes to selling the synagogue and do not require the seller to be able to buy it back whenever he should so please. The one restriction is that the sellers may not sell it knowing that it will be used for a something smelly (a tannery, a urinal) or for something where people will be naked (a bathhouse or a ritual bath).
Section three: Rabbi Judah points out that if the synagogues owners cannot by right repurchase the synagogue, then the new owners can trick the system by first buying it to be a courtyard and then doing with it whatever they like, including turning it into a urinal. It is unclear whether Rabbi Judah says that this is permitted and theres nothing that can be done about it, or what he is really doing is criticizing the sages position by pointing out that they cant really enforce their halakhah. As we shall see in the next mishnah, Rabbi Judah believes that a synagogue retains its sanctity even after it is destroyed. It therefore seems less likely that Rabbi Judah would condone the synagogue becoming something like a urinal.