A U.S. regulator has ordered Merrill Lynch & Co to pay close to $40 million after its Advest unit advised an endowment to buy a stake in a fund affiliated with the collapsed commodities broker Refco Inc.

Merrill, now owned by Bank of America Corp (BAC.N: Quote, Profile, Research, Stock Buzz), will pay damages of $30.6 million plus interest of 9 percent a year dating back to November 4, 2005, the Financial Industry Regulatory Authority said.

The trustees of the endowment -- the Masonic Hall and Asylum Fund in Utica, New York -- said the endowment invested in the Sphinx Managed Futures Index Fund, run by Refco, on the advice of Advest.

Refco sought bankruptcy protection in October 2005 after revealing it had hidden millions of dollars in bad customer debt.

FINRA awarded Merrill the right to claim damages through the Refco bankruptcy proceedings.

Merrill was acquired on Jan. 1 by Bank of America. FINRA regulates close to 5,000 brokerages. (Reporting by Elinor Comlay; Editing by Steve Orlofsky)