Bava Batra 21 - Restrictions on Commercial Activities in a Courtyard

If a courtyard resident has set up a store in the courtyard, one of the other residents can block him by claiming, "I cannot sleep due to the noise of your customers who go in and out of the courtyard."

But a courtyard resident may manufacture utensils in his home and go out and sell them in the marketplace, and one cannot block him by claiming, "I cannot sleep due to the noise of the hammer," or "I cannot sleep due to the noise of the children."

Why can the children go in and out, while the customers can't? These are school children coming to learn Torah. This ruling was taught after Yehoshua ben Gamla, a high priest, mandated the installation of teachers in every town, and he is remembered for good for preserving Torah study.