Yes, for some games, there is a 2-player and a 4-player ROM version. For those, I have the 4-player version and they work fine. But for a bunch of them (too many to list here), the same ROM file contains 2, 3, or 4 player versions and is adjustable by DIP switch.
It's not just this setting; if I change any DIP switch settings, in any of my games, it only lasts until I end that particular session; Mame reverts back to the DIP defaults every time a game starts up again. This is true whether I do it through Mame (TAB key) or through the game's built-in service mode (F2 key), if available.
It just happens that, 95% of the time, the only DIP switch I care about is the one that activates the 3- or 4-player mode. The other 5% of the time, I might want to fiddle with the coin/continue/lives settings or something like that.