For every inspection of a new building or of an old building repaired or altered the following fees shall be charged: Two dollars for each mercantile store room, livery stable or building for manufacturing of one story, and fifty cents per room. But the inspection fee shall in no case exceed five dollars. Before issuing any building permit such fee shall be paid to the city treasurer. The building inspector shall be paid adequate compensation by the city or town for inspections made under the terms of this chapter.