Black bars on core-provided aspect ratio in MAME

I’m having trouble using my CRT monitor with MAME. The core-provided aspect ratio should be correct. However, I get noticeable horizontal letterboxing on the top and bottom, even though the game and monitor are both 4:3. What might be causing this?

It only happens with CRT SwitchRes turned on, but I would like to use it. I found that if I change Fullscreen Height and use a custom aspect ratio height that I can get rid of them; but I’d like to know why core-provided or 4:3 don’t work automatically.

In other words, core-provided only fits the screen properly when CRT SwitchRes is off, but this only happens with MAME.