Three Massachusetts utilities and Central Maine Power’s parent company have agreed that Massachusetts ratepayers must shoulder $512 million in additional costs caused by delays in construction of a power transmission project in Maine that will allow Canadian hydropower to reach the New England power grid.