Pharmaceutical companies settle state lawsuit for $242 million