You could have answered that with a simple act of RTFA. In short: no. They had no access to their subjects' mental health records.
I put up my screed on the weakness of the study (after seeing it covered by the Grauniad) at http://tmblr.co/ZaUL7yHBNSh0 before I saw it here, and the short version of my unassailable opinion is that it is a deeply flawed study whose data is just good enough to make a strong case for further study, undermined by the authors drawing unsupportable conclusions and pointlessly denigrating prior work and practical experience.
And yes, hypnotics are often taken by people for whom insomnia is a secondary condition grounded in deeper problems. That doesn't mean the hypnotics are not very useful in enabling them to address the deeper problems. Speaking from personal experience, a dozen doses of Ambien taken over the space of about 2 months during the breakup of my first marriage were critical to saving my job, my ability to eventually pull out of a deep depression, and possibly as many as 4 lives. When life is slicing deep enough that you cannot sleep for days on end, the lack of sleep itself gnaws on the stripped bones of sanity.
The main recommended use of hypnotics is for short periods in cases where insomnia itself is causing additional problems and more comprehensive treatments for underlying primary causes are too slow and/or are impeded by the effects of insomnia. Real primary insomnia that can be managed with hypnotics is pretty rare. A valid conclusion from the study is that people in that one HMO in rural PA who are being prescribed hypnotics are not getting adequate overall care, and that the inadequacy correlates with the amount of hypnotics that they are being prescribed. The authors claim (and I tend to believe them) that there is a growing consensus that CBT is a better treatment for chronic insomnia, but CBT is not something a doctor can write a scrip for and have the patient sleeping soundly that night for a few bucks. It can also uncover and address underlying issues like depression, OCD, and other cases where insomnia is really just a symptom of a more complex primary mental disorder. Of course, if you are a researcher specializing in retrospective studies of this sort who has been given access to a very large data set of patient records by an HMO, you don't have a strong incentive to write a conclusion that this HMO is controlling costs by encouraging doctors to prescribe cheap drugs instead of referring patients to expensive months-long rounds of a talk therapy, even when the best type seems to be the relatively efficient CBT.