Sunoco Inc. (SUN) has agreed to purchase a biofuels plant in upstate New York for $8.5 million from a company that filed for bankruptcy protection earlier this year, according to court documents.

The agreement between the Philadelphia-based oil refiner and Northeast Biofuels L.P. is subject to court approval.

This is the second deal between a major independent oil refiner and a financially-troubled ethanol producer. Earlier this year, Valero Energy Corp. (VLO) bought seven of VeraSun LLC's ethanol plants for $477 million.

The Northeast Biofuels plant located in Volney, New York, has the capacity to process 100 million gallons of ethanol a year. Northeast Biofuels reportedly filed for bankruptcy because the plant had a design flaw that prevented it from properly working.

The cost to fix the facility is estimated at $10 million, which brings Sunoco's investment to about 18.5 cents per gallon of capacity, according to a bankruptcy consultant familiar with the matter. Valero bought the Vera Sun plants for 61 cents per gallon of capacity.

The operational troubles at the Northeast Biofuels plant may explain why Sunoco was able to get such a low price, refining analyst Chi Chow wrote in a note to clients Tuesday afternoon.

"Sunoco's actions points further to the US refiners' acknowledgement that biofuels will represent an increasing, long-term component of the US refined product pool, and that the companies are increasingly positioning themselves as providers of all transportation fuels (not just petroleum-based products) to remain competitive long-term," Chow said.

(Mara Lemos-Stein in New York contributed to this report)

-By Susan Daker, Dow Jones Newswires; (713) 547-9208; susan.daker@dowjones.com