Section 32. Any person violating any provision of section thirty, thirty A, or thirty-one, or the regulations made or permits granted under authority thereof shall be punished by a fine of not more than one hundred dollars, to be paid to the commonwealth when state highways are injured and to the county, city or town when any public way is injured which is under the care of said county, city or town, for use on the public ways of said county, city or town.