Those are the colors that come in cable! Don't read anything more into it.
You see black and white because those are the colors that are built into all cable (except the cable with a third wire; that is red).
It's very common for novices to try to assign meanings to the colors. That is almost a lost cause. The only way colors have meanings is if you re-color them with colored tape. Otherwise, it doesn't tell you much. This much we know:
Green, yellow-green and bare are always Equipment Safety Ground. Fullstop.
White is first given to neutral, if that is not present it's given to always-hot, and if neither are present, then it's a dog's breakfast.
Wow, that wasn't very helpful, was it?
Anyway, this job was done by a harpsichordist
When white is used for non-neutral, it's usually only 1 cable in the box, and very rarely 2 out of 3+ cables. When 3+ cables have all their whites in communication, that means White is actually neutral -- or at least, the same t hing.
Another law in the - well, almost everywhere - is that you switch the "hot" wire, so when the switch is off, the lamp is inert/safe. So normally, black (well, non-white) wires go to the switch. It was done backwards here! What exactly that means, we don't know. Either
In this switch box alone, the installer chose to switch the neutral wire, but white is still neutral and black is still hot. Or...
Harpsichordist theory: the person used white for hot (and black for neutral) throughout the circuit, renovation, or house.
Which one? That's what needs investigation. That's why ThreePhaseEel would like to peekaboo inside the panel - or at least confirm that white-to-ground is near 0 volts.
If everything else in the house is correct, then repairing this is a simple matter.
- Note the solo white coming off the switch. Its partner black is supposed to be the switched-hot, so use red tape or shrink-tube to re-mark it red. (red is preferred for switched-hot; this is not a Code requirement but it makes wiring easier, especially for novices).
- Remove the switch.
- Re-mark the white pigtail black (mandatory to mark it something; black is preferred for always-hot).
- The switch gets the black pigtail, and the red wire.
- All neutrals go together.
- All always-hots go together. (i.e. unmarked blacks and wires re-marked black).
* What does hot/neutral even mean, given that it's AC power? Neutral is the phase that is bonded to the grounding system, so it's (ideally) quite near natural earth voltage. Touching neutral and a water faucet is usually harmless.