The provincial money will go to rail infrastructure improvements, with work beginning in the spring, Premier David Alward announced Friday.
"Freight rail is a critical mode of transportation for industries in northern New Brunswick, and it is a vital lifeline for the jobs and communities that rely on these industries," Alward said in a statement.
"Our investment in the rehabilitation of two sections of railway line ensures companies in northern New Brunswick can continue to ship their goods to market efficiently and explore new opportunities for growth."
Jim Feeny, a spokesman for CN (TSX:CNR), said under the agreement the company will also invest between $25 million to $30 million on maintenance, operating expenses and customer service improvements.
The government and CN said the deal would ensure continued freight service for 15 years on the rail line's northern and southern sections.
The sections run between Irvco and Nepisquit Junction in the north and between Catamount and Nelson Junction in the south.
CN is still applying to abandon rail operations on the 70-kilometre long middle section between Nelson Junction and Nepisquit Junction because of the cost to maintain it and a lack of freight traffic, the government said. That portion of the railway is used by Via Rail for passenger service.
The section will be offered for sale in early February to private interests for a five-month period and then to the municipal, provincial and federal levels of government as required under the Canada Transportation Act.
Mylene Belanger, a spokeswoman for Via Rail, said the passenger train will continue on this route until it is no longer available.
She said if the route is abandoned, Via Rail will examine the commercial viability of an alternative route, including the line between Moncton and Edmundston, N.B.