A federal judge ordered the ads in response to a lawsuit accusing the firms of deceiving the public.