Since an entrance fee was mandatory to enter the beis midrash, is the reason that Hillel was permitted to listen from the roof the fact that he didn't enter the beis midrash, and thus was not obligated to pay the entrance fee? Or was the fee simply to enable one to hear the shiur, which presumably he would have to pay even if he was listening from the roof?
The Sha"ch Choshen Mishpat 292/35 rules that "stealing" and learning Torah knowledge is permissible, when it is not accessible otherwise. He quotes a Tosefta that says that one that does so, can even become a leader of others. Rav Menashe Klein in Mishneh Halachos [Vol. 17 at the end of #148] writes, that the source of the Tosefta could be this story of Hillel who "stole" Torah and became a leader.
The Maharsha (Yoma 35b) offers two possible reasons for the entrance fee, both of which have to do with defraying the cost of the guard of the Beis Medrash.
Alternatively (my explanation), the entrance fee was intended to help defray the general overhead expenses; maintenance, lighting, heating, water.
It follows, that the charge only applies to someone entering the building, not to someone who hears the Torah from outside. Much the same, as someone who walks by a concert hall, and is able to hear the music from outside, that doesn't need to pay for what he hears.
Here’s some of my own conjecture:
Charging money for Divrey Torah (teaching Torah) is prohibited ("מה אני בחינם אף אתם בחינם" Nedorim 37a). We can conclude then, that the payment covered the other expenses of the Beis Midrash (cleaning, maintenance, security, etc).
As we hold that "נר לאחד - נר לרבים" - a man can enjoy the light of others, the soundwaves that leave the walls of the Beis Midrash are free to use, record, or else.
Therefore, by the law, Hillel could freely enjoy the sound coming from the Beis Midrash.
Now, Hillel was known for his piety, so was he allowed listening for free לפני משורת הדין? As I commented earlier, it appears that he was Onus (forced by the circumstances) that single day (and it wasn't his usual conduct), and therefore he wasn't obligated to pay even לפני משורת הדין.
Another possibility, that he decided to pay the money later as a debt - the Gemmorah says nothing about his monetary intentions.