Section 75. Whoever occupies or uses a building for a hospital in a part of a town prohibited by the aldermen or selectmen shall forfeit not more than fifty dollars for every month of such occupancy or use and in like proportion for a shorter time. The supreme judicial or superior court may restrain such occupancy or use.