If you are willing to go 'third party', there are excellent macro lens from Tamron (90mm), Tokina (100mm) and Sigma (105mm). These are all a lot cheaper then the Nikon 105mm VR but will provide images which are just as good. They don't have VR (which isn't useful for macros anyway), extend when you focus to the 1:1 macro range (which the Nikon doesn't do) and aren't 'Nikon'. The latest version of the Tamron will AF on the D40 but, most macro work is MF not AF so that's only a limitation if you plan to use the lens for portraits or general telephoto work.
If you do a search in this forum, you'll find more information and photos.