PORTLAND, Maine — An iconic baked beans factory that stood for more than 150 years is going to cease production to make way for an institution affiliated with Northeastern University, officials said Monday.

A nonprofit representing the Roux Institute at Northeastern University is buying the waterfront property, which will be used for offices, classrooms and research space, in addition to restaurants and possibly a hotel, the Portland Press Herald reported.

The B&M Beans factory dates to 1867 when Burnham and Morrill Co. began canning meats and vegetables. Baked beans, which are widely associated with New England, came later.

A purchase-and-sale agreement for the 13.5-acre property overlooking Casco Bay was completed Monday, the newspaper said.

The company acknowledged that the factory was built for another era but said the decision “was not made lightly.” Production of baked beans will move to the Midwest, the company said.

Portland residents have fond memories of the five-story factory — and the familiar smell of baked beans wafting through the air.

Boston-based Northeastern University had been scouting out locations for a satellite institution in Portland since the institute launched in early 2020 following a $100 million donation from Maine native David Roux, a technology entrepreneur, and his wife, Barbara.

The tech-oriented campus is intended to house graduate-level programs, research and business development, officials said.

Under the plan, there will be up to 350,000 square feet of office, classroom and laboratory space, parking and a possible hotel, the newspaper said. The B&M factory would be renovated and converted into incubator space for business startups.