The Commissioner of Transportation, on the application in writing of the selectmen of any town, the mayor and common council of any city or the warden and burgesses of any borough or on the commissioner’s own motion, may make all necessary orders concerning the establishment of a temporary grade crossing over the tracks of any railway during the period of construction of a permanent grade separation structure which will carry a highway over or under such tracks, provided the state, town, city or borough making such application shall bear the cost of any necessary signs, signals, gates, flagmen or other protective devices.