Daled Adar II, 5774
A certain beis hamedrash in Cracow, Poland, was located on the second story of the building, while the first floor housed a store which sold electrical lighting equipment. The owner of the store approached the gabboim of the beis hamedrash with a deal. He asked the gabboim for permission to advertise his lights on the roof of the beis hamedrash, and in turn he would cover the costs of renovating the roof, as well as pay a yearly fee. Were the gabboim allowed to give him the go-ahead to use the roof of the beis hamedrash for such a purpose?
The gabboim posed the question to the rav of the city, Harav Yosef Nechemya Kurnitzer A"h. R' Yosef Nechemya quoted the Gemara in Pesachim (85b-86a) where it is stated that the attics and roofs of the heichal were considered holy, while those of the azarah were not. A shul is called a mikdash me'at. Should it be compared to the azarah or to the heichal?
On one hand, tefillah is compared to ketores (see Tehillim 141:2, Malachi 1:11 and Rashi ad loc.), a service performed in the heichal. On the other hand, one can argue that the reason why the attic of the heichal was holy was because Hashem relayed to Shlomo Hamelech the exact height of the heichal (see Divrei Hayamim I 28:10), which encompassed the attic as well. The holiness of a shul, however, might be limited strictly to its actual domain.
This discussion, though, is just theoretical: the Shulchan Aruch rules (Orach Chaim 151:12) that the attic of a shul may not be used for a derogatory use, while a doubt exists regarding using an attic for other functions. Although one can argue that advertising is not a disgraceful act, the doubt of the Shulchan Aruch would seemingly require a stringent ruling in this case.
However, another factor exists that can play a role in this scenario. It is common practice to conduct festive meals in shuls, while some even use the site to sell seforim and similar wares. As a rule, Halachah prohibits such conduct in a shul (Shulchan Aruch Orach Chaim 151:1), and even specifying a condition in advance does not permit these activities (ibid. 11). How is it, then, that such behavior continues unopposed?
R' Yosef Nechemya posits that although such conduct might have begun in an impermissible manner, once it became common practice, it is considered as if the beis din stated a condition prior to the building of the shul or beis hamedrash that it will contain a limited degree of holiness, similar to a private beis hamedrash which carries a lower level of sanctity (ibid. 2). This would allow other inoffensive activities to be carried out in the vicinity.
R' Yosef Nechemya concludes that it would therefore be permitted for the gabboim to go ahead with the deal, provided that installing the electrical lights does not affect the strength of the walls or lead to bittul Torah.
(Shaalos U'teshuvos Rabbeinu Yosef Nechemya, Orach Chaim §4)