- Scandinavia is very far north and therefore gets less sun in the winter (obviously)
- Apparently the soil of Scandinavia is well suited to crops that are high in Vitamin D
The soil being good for Vitamin D crops (plus lightening of skin/hair and fish diets etc) was a part of why people were able to live in such far northern climates even if they didn't always have access to fish.
IIUC it's the other way around. soil/climate allows for foods low in Vitamin D -> Vitamin D needed from other sources -> evolutionary pressure for getting it from the sun -> less melanin in skin
Some fungi have decent vitamin D, but it's certainly not a major "crop" in Scandinavia.
"White" and "dark" refer to the skin's effects on visible light. Visible light is different wavelengths from UV light; vitamin D production in the skin depends on UV light. "Dark" skin blocks UV light more than "white" skin does.
I think this is how it works: The melanin is not transparent, so it stops the light from penetrating beyond the very surface, and so a smaller volume of skin cells get access to sunlight.
To go a little deeper: Sunlight does two major things in our skin. It creates vitamin D, and destroys folate. Both are essential, so the various skin colors we have reflect the balance evolution has struck in various environments.
Incidentally you can test this yourself: if you go out in the summer you will tan i.e. your skin will darken. This is adaptation to lower the risk of sunburn and skin cancer.
If you could design a human from scratch, it might be most efficient to give northerners a D synthesizing pigment that's opaque in the necessary wavelength, resulting in the situation you describe.
Instead we have protective pigments near the surface, synthesizing structures underneath, and a need to balance D synthesis against UV damage.
Sure, some photons do get reflected, but the benefit is from those photons that get deeper into the skin.
White skin itself is an evolutionary adaption for getting enough vitamin D outside of tropical Africa. The extreme "melanin-anemic" blond & blue eyes look of Scandinavia is thought to be because it has a uniquely warm weather for the latitude, which make it possible to grow (vitamin D poor) grains there. That supports by far the biggest population density that far north, but also induces extreme whiteness to soak up every possible sun ray.
Conversely, if you have dark skin and live in the non tropics, you absolutely need to monitor and enhance your vitamin D intake. Sadly, doctors don't seem to bring this up with dark skinned patients, at least from what I hear from my (OK, not that many...) black friends.