In Sweden’s case it’s because we - as a nation - view non state sanctioned drug use in any form as a moral failing, rather than medical one. Lethality among heavy drug users is really high compared to Central European countries, and politicians think that’s fine as long as the stats for how many people have used drugs in any capacity look good.
In sweden, yeah, two things: there has been much, too much, batshit-insane anti drug/prohibitionist propaganda for decades. And the fact nations are bound by the UN Convention that mandate prohibition. Politicians are retards who rather see people die than legalize...
The Netherlands has had that policy since the '90s, if not earlier -- although in recent years (last 10 or so) governments have been steadily moving to a more repressive and less curative stance. Mostly because of our police's failure to deal with organized crime producing harddrugs, but they're throwing marihuana under the bus as well.