NEW YORK, SEPT. 27 -- Warren E. Buffett, whose stock market acumen has made him one the richest independent investors in the country, has agreed to buy a 12 percent stake in Salomon Brothers Inc., one of Wall Street's most prominent investment banking firms, for $700 million.

In a simultaneous announcement today, Salomon said it has agreed to buy out a 12 percent stake in the firm owned by Minerals and Resources Corp. Ltd., a subsidiary of the giant South African conglomerate Anglo-American Corp. Salomon said its agreement with Minorco carries a total price of $809 million.

Wall Street sources said Salomon's deal with Buffett's firm, Berkshire Hathaway Inc., emerged only a week ago, when Minorco disclosed that it was interested in selling its stake in the investment banker.

Minorco wants to concentrate its investments in the minerals and natural resources business and has been winding down its stake in Salomon, which totaled 20 percent two years ago.

The sources said Salomon Chairman John H. Gutfreund became concerned that Minorco's 12 percent stake might fall into unfriendly hands if the company chose to sell. An American company expressed serious interest in the Minorco's Salomon stock earlier in the week, the sources said, but the identity of that company could not be learned tonight.

Wall Street sources said that Gutfreund and Buffett have worked together on various transactions for years and that the two men discussed from time to time the possibility of a closer affiliation.

The sources said that Buffett had recently mentioned to Gutfreund his possible interest in investing in Salomon.

When Gutfreund became concerned about Minorco's interest in selling its shares, sources said, he contacted Buffett and began discussions with the Omaha, Neb.-based investor. The two men met in New York last Tuesday to begin negotiations, the sources said. The deal was closed over the weekend.

Salomon and other major Wall Street firms have experienced tremendous growth during the 1980s, but that rapid expansion has recently led to management and financial problems at some of the firms. Salomon was one of several Wall Street firms to lose tens of millions of dollars while trading in mortgage-backed securities earlier this year.

Buffett, who owns a major stake in Capital Cities/ABC Inc. and has been an investor in Washington-based Geico Corp. and The Washington Post Co., is said by Wall Street sources familiar with his thinking to regard Salomon as an attractive long-term investment.

He is said to believe that after the firm weathers the short-run difficulties caused by its rapid growth, Salomon will become exceptionally profitable.

Buffett and Charles T. Munger, vice chairman of Berkshire Hathaway, a holding company for Buffett's investments, will join the Salomon board if that board approves the deal. Buffett's deal with Salomon provides for a seven-year "standstill" during which Buffett has agreed not to purchase any more Salomon shares.

The transaction has been structured so that Buffett's $700 million investment will be used by Salomon to finance the repurchase of Minorco's stake in the firm. Buffett will receive a 9 percent dividend for three years from the preferred shares that Salomon will issue to him.

Buffett will have the right to convert his preferred shares to common stock at a price of $38 a share, the same price Salomon has agreed to pay Minorco. Salomon also retains a right of first refusal to buy Buffett's shares should the investor ever decide to sell.

Wall Street sources said that Salomon's divestment of Minorco's stake was only partially related to pressure by activists opposed to the apartheid policies of South Africa's government. The sources said that Salomon disposed of its own South African operations about 18 months ago.