It is not lawful for:
to acquire the franchises or property of any similar corporation carrying on its operations with any city or town, or partly in such city or town and in the territory adjacent to same, by consolidation, purchase, lease or other mode, except only by and with the permission and consent, expressed officially in writing, of the municipal government of the city or town in which the corporation whose franchises or property is being acquired carries on its business, wholly or in part, and then only upon such terms and conditions as the municipal government may prescribe; provided, that such terms and conditions shall not violate any law.