About paying for itself, Yes it can if you want an F/2.8 200mm zoom then the D90 can use a older version of the 80-200 which sells used for about $650 while the D40 would require s newer 70-200. for about twice the price. But the 70-200 is a slightly better lens with more features. But if the only features that matter to you are the f/2.8 and 200mm it really is the same thing at half the price. With an SLR you have to step back and look at the total system and price that.
Are you saying that the AF-S 80-200 wouldn't work on the D40? You rarely find an 80-200 selling for less than about $800 if it's in great condition, unless it's the really old push-pull (I have one.) The AF-S version goes for about $230 more than the AF-D version, and the 70-200 is about $600 more than that (more than twice the 80-200, but it has VR.) Also, the D40 can use the AF-D version fine in manual focus mode, which if you're shooting around infinity really doesn't make things that bad- so it's not accurate that the D40 *requires* a newer lens, and I can't see any reason the D40 couldn't use the AF-S version of the 80-200.
Finally, it's worth looking at the Sigma 70-200 HSM II if you're looking at the 80-200, since out to the APS-C sensor edge the current AF-S Nikkor looks to be about the same in resolution and maybe a bit worse in contrast (it wins out to FX though.) The Sigma will almost certainly be better than the original "cheap" 80-200s, especially given the change in ED glass and optical coatings since the older 80-200 was designed.
Even if you just shoot at 200mm at f/2.8, you're not comparing apples to apples with either of the 80-200 AF-D lenses, the 80-200 AF-S lens, the 70-200VR or either of the Sigma 70-200 HSM lenses, and only the older two Nikkors won't AF on a D40- but if your'e trading in a D40 and buying a D90, you probably just made the middle-priced lenses less expensive on the D40 than cheaping out on the lens and getting a D90.