Very early in the Daf Yomi cycle, way back in Tractate Berakhot, I remember reading about the principle that in sacred things, we elevate and do not lower. In a debate over the right way to light candles on Hanukkah, Beit Shammai argued that we should start with eight candles on the first night and then reduce the number each night; Beit Hillel, by contrast, said that we should start with one candle and build up to eight. As usual, Hillel’s interpretation prevailed, because of the principle that we should always try to increase our sanctity, rather than lessen it.

With candles, this is straightforward enough. But what happens, the Talmud asked in this week’s Daf Yomi reading, when we are talking about the sanctity of a piece of real estate—for instance, a synagogue or a study hall? To take a place where Jews worshipped God and turn it into something else, like a store or a house, would clearly mean lessening its sanctity. Yet if a building that once served as a synagogue had to remain a synagogue forever, then it could never be sold, even if the Jewish community dwindled and it wasn’t needed any longer. And a community or an individual might be less inclined to build a synagogue in the first place if there was no chance of ever recovering the initial investment. How can we respect both the sanctity of the synagogue and the practical needs of the Jews who built it?

Chapter 4 of Tractate Megilla begins by taking up this question, which on its face has nothing to do with Purim, the main subject of the tractate. (I’ve noticed that it’s not uncommon for the last chapter of a tractate to become a miscellany, mopping up various side-issues that the rabbis couldn’t find a place for earlier.) The mishna on Megilla 25b begins by establishing a scale of holiness. A town square, where Jews would sometimes gather for communal prayer, has a low level of sanctity; it is less holy than a synagogue, where prayers take place regularly. The synagogue, in turn is less holy than an ark, which actually contains a Torah scroll; the ark is less holy than the cloths used to wrap the scroll; and the cloths are less holy than the Sefer Torah itself. Once, sanctity was determined by proximity to the Holy of Holies in the Temple; today, the Torah itself stands at the sacred center of Judaism, and the closer an object physically is to the Torah the more respect it is owed.

It follows that it is forbidden to travel the wrong way on this ladder of sanctity. A Jewish community can sell its town square and use the funds to buy a synagogue, but it can’t sell its synagogue and use the money to buy a town square; and the same logic applies to the other items mentioned. You can use the proceeds of a synagogue sale only to purchase items of greater holiness, like an ark or a Torah scroll. And the same holds true for “surplus funds”: If you sell a synagogue, buy an ark, and have money left over, that money is subject to the same restrictions.

The Gemara clarifies, however, that these guidelines apply only to synagogue buildings that are owned privately or by a small group—what the rabbis call “the synagogue of a village.” Such buildings can be sold under the right circumstances, but “the synagogue of a city” cannot sold for any reason, “because it is considered to be the property of the public at large.” When a lot of people count on using a synagogue, it must remain open for use. However, the rabbis must have recognized that this rule would create practical difficulties, because they immediately craft a loophole. A community itself cannot sell its synagogue, but if it appoints a board of seven representatives, they can annul the building’s sanctity and sell it. In that case, the proceeds are not restricted and can be used for any purpose, “even to drink beer with.”

Now we know that you cannot sell something sacred and use the money for something less sacred. But can you use a sacred item to acquire something of the same degree of sanctity? This problem is raised by Rami bar Abba, who was once building a new synagogue and wanted to demolish an old one in order to use the “bricks and beams.” It may seem that this should be no problem, since the level of sanctity of the bricks and beams would not be reduced. Still, the project might run afoul of Rav Chisda’s rule, “One should not demolish a synagogue until one has built another synagogue.” Rami bar Abba thought not; that law was instituted to rule out the chance that you might demolish a synagogue and then fail to build a replacement. But in his project, the very materials of the old synagogue were going to be used in the new one. However, Rav Pappa and Rav Huna both disagreed, and they forbade Rami from demolishing the old synagogue until the new one was built. Clearly, the rabbis weren’t as into recycling as we are today.

Next, the Gemara moves on from synagogues to consider the status of other sacred items. In general, “articles used in the performance of a mitzvah may be thrown out”: A shofar or worn-out tzitzit do not retain any holiness and can be discarded. But things are different with what the Talmud calls “articles of sanctity,” which are anything that includes written verses from the Torah: mezuzot, tefillin, and of course Torah scrolls themselves. By extension, anything used to cover or hold an “article of sanctity” is also sacred: a cover for a Torah scroll, tefillin straps. And the Gemara goes on to broaden this category still further, by including any item that might come into contact with a Torah scroll, such as a synagogue lectern or the curtain of the ark. These strictures evolved into the custom of preserving any document that had Hebrew writing in it—a custom that historians love, since it resulted in the creation of unintentional archives like the famous Cairo Geniza.

Rabbi Meir attempts to add yet another restriction on the sale of synagogues and sacred items. If the goal is to avoid the lessening of sanctity, then surely it should be forbidden to take a synagogue that belongs to the Jewish community and sell it to an individual. Such a sale would diminish the number of people who can benefit from the building and so diminish its holiness. But here the rabbis disagree, thinking that Meir’s restriction goes too far. After all, the rabbis argue, by Meir’s logic it would also be illegal to transfer a sacred item from a larger community to a smaller one, since that too limits its potential usefulness. Yet no one would think of imposing such a rule. Even with a principle as important as increasing sanctity, the rabbis recognize the need to live in the real world, and they craft laws that Jews can manage to follow.

Still, if you do buy a synagogue, you can’t do just anything you like with it. Specifically, you can’t use it for undignified purposes: “They may sell a synagogue with a permanent sale for any usage, except the following four things: for a bathhouse, for a tannery, for immersion [that is, a ritual bath], or for a lavatory.” Anything involving nudity or bodily waste would be an insult to the memory of the synagogue. By the same principle, the Gemara goes on to note, if you are praying and you have to urinate, you must move four cubits from where you were standing. The body shouldn’t be allowed to intrude on places consecrated to the soul.