I know that folks who own older non AF-S lenses will have a different viewpoint, but the 'limitation' in lenses just means that you'll be using a newer lens instead of a 2 or 3 generation old lens. I may have missed one or two, but I don't see any recently released (1-2 years) Nikon, Sigma or Tamron lens that won't auto focus with a D40-D5000 camera. All of these companies have lenses that are older than AF-S that are still available as part of their product line; but that's really an artifact of the photography industry not being really up to speed with the rate of technological change.
In film camera days, a lens would be usable with a line of cameras for 20-50 years. Early manual focus lenses will work in fully manual mode on the newest film lenses. Even early Nikon F-mount manual lenses will work with Nikon digital cameras.
Nikon, unlike the -C- company, has never intentionally obsoleted their lenses. That has led to a somewhat skewed view that if you can't handle screw focus lenses that the camera is somehow inferior.
In attempting to respond to a market that is relentlessly driving features to lower price points, Nikon has chosen to separate their AF motors from the camera itself.
This is a trend that will continue. The only situation where it will cost more for a lens for a D40 is that you can't choose from 30+ years of AF lenses. You'll have to stick with newer AF-S (and compatible) lenses.