Section 167. Every passenger, baggage, mail and express car, equipped with platforms, and owned or regularly used on any railroad in the commonwealth shall be provided at each end thereof with platform gates of a pattern approved by the department. A railroad corporation which hauls or uses, or permits to be hauled or used, on its railroad any car in violation of this section shall forfeit one hundred dollars to the use of the commonwealth, and the attorney general or the district attorney for the district where such violation occurred shall bring an action therefor.