BankAmerica Corp. yesterday formally took control of Seafirst Corp., the Seattle bank holding company that became a casualty of the Penn Square National Bank failure last July.

Had Seafirst been forced to close its doors, the insolvency would have dwarfed all previous U.S. bank failures.

BankAmerica paid $250 million for the bank in a combination of cash and preferred stock. The giant San Francisco bank company also agreed to inject $150 million into Seafirst to make up for some of the huge losses Seafirst incurred from bad energy loans it purchased from Penn Square of Oklahoma City.

Regulators reluctantly approved the acquisition of Seafirst, which has assets of $9.6 billion, by the $119.7-billion-asset BankAmerica, to prevent an almost assured Seafirst failure.

At the end, Seafirst was kept afloat by hundreds of millions of dollars of loans from the Federal Reserve system. Many depositors, scared by mounting loan losses at Seafirst, pulled out their deposits. The Fed loans helped to replace those deposits as Seafirst's ability to offset the losses dwindled.

Presumably BankAmerica--which owns the nation's second-largest bank, Bank of America--will repay those Fed loans during the next few weeks. Informed sources in New York said Seafirst borrowed at least $500 million and perhaps as much as $800 million to stay afloat.

Disgruntled Seafirst shareholders approved the BankAmerica acquisition last Tuesday. At best, they will receive about $16 for each share of their Seafirst stock in a combination of cash and securities. They could receive as little as $8.30. A year ago, before the Penn Square debacle, Seafirst stock had been trading as high as $28.75 a share.

Under the terms of the BankAmerica acquisition, Seafirst shareholders will receive $7.68 in cash and three-tenths of a share of BankAmerica preferred stock for each Seafirst share. The BankAmerica preferred stock has a redemption value of $25 a share. But if Seafirst's losses on a pool of already identified problem loans exceed $350 million, the redemption value of the preferred stock will be reduced. It could go as low as $2.

Seafirst Chairman Richard Cooley, who was hired Jan. 1 to try to revive the bank, told shareholders last Tuesday that Seafirst could survive on its own no more than another three or four weeks.

Cooley told reporters that, when he was hired away from Wells Fargo, a big California bank, he had no idea how bad things were at Seafirst. Had he known, he probably would still be at Wells Fargo, Cooley said.

Seafirst posted huge losses on the loans it purchased from Penn Square. At the end of 1981, Seafirst had $567 million in capital. By last March, loan losses had cut that capital base to $323 million. BankAmerica will add $150 million to Seafirst's capital.

Other major banks suffered as a result of problem loans they purchased from Penn Square. Continental Illinois National Bank bought more than $1 billion of loans originally made by Penn Square. Chase Manhattan and Michigan National also purchased loans from Penn Square, most of which turned out to be bad.

The Oklahoma City bank failed last July 5, when regulators determined that the $500-million-asset institution had many millions of dollars more of bad loans than it had in capital.