Section 52. A town in which no person or corporation is engaged in generating or distributing electricity for sale and which has voted or shall vote to construct one or more plants for the manufacture or distribution of electricity for municipal use or for the use of its inhabitants, or for both purposes, may make contracts, for terms not exceeding ten years, with any street railway company operating a street railway in such town, for the purchase of electricity from such company in order to furnish electricity for municipal use or for the use of its inhabitants, or both; and street railway companies may make contracts to furnish electricity as aforesaid to a town, but the contracts shall not become operative unless the department shall, after a public hearing, approve the terms thereof as consistent with the public interest. This and the three following sections shall not apply to cities.