Federal and state officials on Wednesday filed lawsuits accusing dozens of companies of ripping off struggling homeowners by falsely promising help in avoiding foreclosures or lowering mortgage payments while collecting millions of dollars in illegal upfront fees.