Maxicare Health Plans Inc. announced yesterday an agreement to purchase HealthAmerica Corp., in a deal that will create the largest for-profit health maintenance organization in the country.

The deal will accelerate Maxicare's meteoric growth of the past five years and establishes the Los Angeles-based HMO company as one of the major players in the rapidly changing group health insurance market, industry officials and observers said.

Maxicare said it would pay $16 for each share of the 23.2 million outstanding shares of HealthAmerica stock, plus certain rights to buy Maxicare stock in the future. The company said the transaction was worth about $400 million.

Maxicare will virtually double in size as a result of this deal, which is expected to close in November, and a previously announced agreement to purchase HealthCare USA Inc., another large HMO. The combined company will have roughly 2 million members in 32 states and annual revenue of $1.6 billion, Maxicare officials said. As recently as 1982, Maxicare's revenue was just over $100 million.

"The combined company will clearly be able to serve more markets than any other HMO in the nation, with the immediate capability to service national employers in 24 of the 30 largest markets in the U.S.," said Fred W. Wasserman, Maxicare's chief executive officer.

Maxicare and HealthAmerica, of Nashville, are among the biggest winners in the recent explosion of popularity in prepaid health plans, which has come at the expense of traditional indemnity insurance plans. HMOs offer health care for one set fee through a selected network of physicians and hospitals, seeking to control costs through carefully reviewing the utilization of all medical services.

But while Maxicare's prospects continue to shine, according to analysts, HealthAmerica's fortunes have waned recently as a result of management problems and difficulties in centralizing more than three dozen disparate health programs. HealthAmerica, which operates an HMO in Baltimore, reportedly has been on the auction block for the last year.

Industry officials described the merger as another in a series of bold strokes by Maxicare and its chairman, Wasserman, who they said have now created the first truly national, for-profit HMO chain. The largest not-for-profit HMO chain is Kaiser Permanente, with 5 million members nationwide.

As such a national firm, they said, Maxicare will be better able to compete against insurance companies and hospital chains for the group health insurance business of large national employers.

"They've raised the stake for everybody else. Everybody else has talked about going nationwide and going to GM and saying, 'We're your HMO,' " said David L. Goldsmith, who follows the HMO industry for Robertson, Colman & Stephens in San Francisco. "No one truly has had the locations actually to be able to do this," he said.

But Goldsmith and other officials emphasized that the merger is fraught with risks for Maxicare, especially in the short term, because of the difficulties in digesting two outside companies while maintaining internal expansion plans. Maxicare also recently embarked on an expensive battle to enter the New York HMO market.

"Everybody in this industry is suffering from a lack of good management. It could be that Maxicare has just acquired a larger management problem," said an executive at one of Maxicare's major competitors, who asked not to be identified.

Peter Grua, who follows Maxicare for Alex. Brown & Sons, the Baltimore investment house, added, "The underlying question is whether they can juggle all these balls at the same time."

Apparently anticipating a short-term earnings dilution, the market reacted with restraint to Maxicare's announcement yesterday, knocking down the price of Maxicare's stock 3 1/4 to 19 5/8. HealthAmerica rose 4 1/2 to close at 15.