A Suffolk County Superior Court judge has ordered two companies accused of fraudulently marketing discount medical plans as if they were health insurance to halt the practice and to pay $2.4 million. The state filed a complaint in 2009 alleging that the companies, Consumer Health Benefit Association and National Benefits Consultants, LLC, sold the discount plans to people who thought they were buying health insurance that satisfied the state's insurance mandate. The plans did not meet state requirements. The judge last week ordered the companies to pay consumers $586,960.95 in restitution and to pay the state $1.78 million in penalties and attorneys' fees. Consumer Health Benefits Association and National Benefits Consultants also have been subject to a probe by the Federal Trade Commission. The two companies have filed for bankruptcy in Florida. That proceeding likely will affect what Massachusetts is able to collect.