At some point the E39 540i engine, actually a 4.4 liter, changed. I think they added Vanos, (BMW's variable valve timing system) or went from single to double Vanos. That change occurred around the 9/98 production date. Both engines make 282 hp, but the earlier engine makes around 323 ft/lbs at 4000 rpm, and the later 335 or so at 3500. There may have been a final drive ratio change.
There are minor trim and wheel changes, the most significant of which occurred for the 2001(?) model year, when they went to "angel eyes" style headlights and different tail lights. The wheels on the 1999s and later cars are the nicer looking radial spoke design, instead of the previous design, which has the look of a 3-piece wheel (bolts around the outer edge).
If you can swing it, I would go for the 2001, as I like the updated look.