The thing is that an enemy only has to not be vulnerable to one thing for a wizard with a good spellbook to be able to defeat it, because the wizard can vary his spell selection. For instance, when entering an undead dungeon, he'd do well to swap out his cold- and electricity- spells for fire and acid ones, or other types of spells entirely. Magic resistance can become a pain in BG2, but it can also be bypassed with the right spell selection (lower resistance being an obvious example). What's more, the effects which mages can produce can be much more effective than what a fighter can do. Even at low levels, where mages tend to have trouble, a spell like Sleep can disable an entire group of enemies in a single round (and in these situations, disabling an enemy effectively means killing them at your leisure after the fight). In a single round, a fighter can damage a single enemy, perhaps killing him. Unless he's an archer, he's also exposing himself to being injured in the process.
At high levels, nothing in the game is "immune to everything". If it was, it would by definition be immune to weapons as well, and your fighter would be in as much trouble as the mage! Assuming you meant "immune to all spell effects", I don't think that's true either. Enemies become immune to quite a few spell effects, perhaps. However, provided you can find one of their achilles' heels in the form of an effect they aren't immune to, and can prepare a high level spell to inflict that effect on them, those immunities count for very little. Even if there is an enemy which is immune to all nonweapon effects on it, which I doubt, a wizard can still make use of his spell slots to buff himself and the rest of the party. Haste, Stoneskin, T.'s Transformation (sorry, I don't remember the name of the spell's inventor; I'm used to third edition where the names were changed) are spells which can make even a wizard a competent melee fighter for a short time.
Meanwhile, a fighter can...hit the enemies with a sword. If that doesn't work (immunity to weapons, mirror image, charm person, etc, etc, etc) he's rather sunk and will have to keep attacking in the hope of getting lucky with his dice rolls. Don't get me wrong, there's definitely a place for fighters in a balanced party, but that's why the mages are considered stronger at higher levels.
Oh, and mages have the potential to drastically outdamage the fighters. 1d6 damage per level in an AoE? And half that damage even if you "miss" (ie your enemy makes his save). Fighters get extra attacks per round, but nowhere near enough to match that.
Post edited August 02, 2014 by pi4t