Section 29A. The department may lay out or alter ways other than state highways in any county, city or town provided that the county commissioner of the county, or the mayor of the city or the board of selectmen of the town consents thereto. Land or rights in land may be acquired for this purpose by eminent domain under chapter seventy-nine by the department in behalf of the county, city or town in which the land lies. Any person whose property has been taken or injured by any action of said department under authority of this section may recover from the commonwealth under chapter seventy-nine such damages therefor as he may be entitled to. For this purpose the department may use any funds which may be available for highway purposes, including federal aid, and may also use any money appropriated for a county, or by a city or town, toward the damages sustained, provided that the county commissioners, selectmen or mayor have agreed in writing to pay the money thus appropriated upon the order of the department.