The free spells in a wizard's spellbook aren't wealth for that wizard
In the same way that a paladin's special mount isn't a factor when computing the paladin's wealth by level, neither is a wizard's free spells from becoming (and advancing as) a wizard a factor when computing the wizard's wealth by level. These are merely class features—benefits gained automatically upon becoming more experienced—, and improving those native class features is one of the many uses for a creature's wealth. Possessing a class feature typically shouldn't subtract from the creature's earnings! (Exceptions exist, though—like the obsolete Oriental Adventures samurai (20-2) that sacrifices treasure to improve his ancestral daisho, but his level 1 masterwork katana and masterwork wakizashi are free and their original prices shouldn't be a factor in computing the OA samurai's wealth by level.)
However, extra spells scribed into the wizard's spellbook during play are part of that wizard's wealth. For example, a player creating a wizard above level 1 should subtract from his wealth by level the costs of both a scroll of the spell and the scribing materials.
Likewise, the DM need not make adjustments to an adventure's treasure because the party happens to include a caster with a spellbook filled with free spells that's been filled solely because the caster leveled up. Similarly, a player who complains about his wizard's poverty after his wizard spent all his treasure filling spellbooks with extra spells is being disingenuous or should've been encouraged earlier by the DM or the party to diversify his purchases.