LOS ANGELES — Countrywide Financial Corp.'s shareholders cleared the way Wednesday for the company to be taken over by Bank of America Corp., even as officials in two states filed lawsuits contending the distressed mortgage lender misled borrowers into taking on risky home loans.

The timing of the lawsuits in California and Illinois as Countrywide prepared to close the books after nearly 40 years underscored the company's dramatic shift over the past 12 months as the mortgage and housing markets soured, inducing its slide from the nation's largest originator and servicer of home loans to easy pickings for a takeover.

The firm, based in Calabasas, Calif., announced that 69 percent of outstanding shares were voted in favor of the Bank of America deal, which is expected to close July 1. The acquisition is expected to give Bank of America control of 20 percent to 25 percent of the home loan market, something the company hopes will pay off handsomely once the housing market recovers.

The California and Illinois lawsuits accuse Countrywide of systematically deceiving borrowers in order to get them to take on risky loans they couldn't really afford, and name chairman and CEO Angelo Mozilo as a defendant. The states both seek unspecified damages and for Countrywide to pay restitution to borrowers who lost their homes or loans.