US food maker B&G Foods has said it has agreed to buy the Ortega Mexican food brand from Nestlé USA, a subsidiary of Swiss food giant Nestlé.