Is it also prescribed for mental illness?
Speaking as a board-certified psychiatrist, I have to say that question is not answerable.
"Mental illness" covers a very broad range of conditions. In most states with medical cannabis laws, cannabis isn't and can't be prescribed for anything. It can be "recommended" or "authorized", or a physician can certify that a patient has a specific condition. Sometimes the authorization is based on a symptom or impairment rather than a diagnosis
Cannabis studies are hampered by many decades of prohibition. There's also the fact that arguably there's no such thing as "cannabis" in a sense that can be researched, given the very wide range of strains with markedly different characteristics. Further, much of the research that people refer to was done with Δ-9 THC, CBD, or a French pharmaceutical product that's 50% Δ-9 THC and 50% CBD. Δ-9 THC has been legal (Schedule III, so less controlled than many pain medications) my entire career (so at least prior to 1988) under the brand name "Marinol®" for appetite stimulation (for which it's essentially useless).
There's pretty strong evidence from multiple studies of varied design supporting efficacy of smoked or vaporized cannabis for PTSD, and less-good evidence of efficacy for some other anxiety disorders. We see a fair amount of cannabis-induced panic in emergency settings, so I'm not sold on its being useful for panic.
As someone who's spent a fair amount of time over 3 ½ decades working with patients with substance use disorders as well as patients who use substances in non-disordered ways, I'm strongly convinced that cannabis is vastly less harmful than alcohol (and that alcohol is considerably more harmful than generally believed, with practically no evidence of any sort of medical benefit), opioids, or stimulants. I know a large number of high-functioning people (surgeons, federal judges, elected officials, etc.) who use cannabis in ways that do not appear problematic. While I know a bunch of high-functioning alcohol users, those with problematic alcohol use represent a higher percentage than I see with cannabis users. There are certainly considerably greater medical risks associated with alcohol use.
Most of this is moot, though, in the context of the original question concerning medical cannabis on Cozumel. Governments don't much care about the opinions of individuals, and often don't care about facts and evidence. Laws are what they are, whether they make sense or whether we agree with them or not.
The law permitting medical use of cannabis in Mexico applies only to Mexican citizens and legal residents. It requires a prescription that must be filled at a pharmacy or licensed cannabis dispensary. In case one is a Mexican citizen or legal resident and can manage to get a prescription (I don't know anyone who has), there are no pharmacies that dispense cannabis or legal cannabis dispensaries on the island. Anyone (Mexican citizen, resident, or foreigner) caught importing cannabis into Mexico, even with a prescription or authorization from someplace, can be charged with very serious drug smuggling offenses.