There is a legal, regulated, mostly safe method to buy cigarettes. It is inaccessible if you are under a certain age, but only the seller/provider is punished for violating regulations. It's okay to have restrictions on what children can consume.
While current laws on illegal drugs do not work, arguing against any regulation whatsoever is similarly silly, the laws obviously work. Smoking rates have dramatically declined since those laws and public education campaigns began.
I dunno, seems like the judge is explicitly acknowledging it.