The E39 is actually good, the 520i (M50 engine) with 150 hp is likely to be the longest-lasting and best engine that has ever existed in this series. You shouldn't expect an athlete, but they are pleasant touring limousines with good comfort.
In 2000 the E39 was revised ------> the facelift changed a lot, there was also a new 2.2-liter engine with 170 hp for the 520, but that is not a car for "dynamic" drivers either. On the other hand, the facelift didn't automatically make everything better; Much could not be improved on the E39.
Well-known weak points are the chassis parts, cylinder head gaskets, water pumps, all sorts of electronic defects (the more extras one has, the worse it can get) and rust over the years -----> you always have to keep it in mind: Even if it is does not seem so old, the E39 from 2000 is an eighteen-year-old vehicle, so natural wear and tear is also an issue. 100,000 miles are not the same as 100,000 miles: if the vehicle has always been maintained, it can do as much again. But if there are gaps in the service booklet or none, several previous owners and the BMW is somehow "tinkered", it should be left standing.
The M-Package is also to be viewed critically: Many BMWs are offered with "M-Package" (!) To attract young people, but mostly none is available, which connoisseurs recognize at first glance ^^ you have to be very careful - ---> And it's worth taking a look at the service booklet, where BMW stuck a sticker with all the optional equipment that the car had ex works. If the M package does not appear, it does not have it or at most someone has tinkered something afterwards. And that is not a good sign -----> such BMWs were mostly driven hard & therefore suffer from extra wear and tear.
In general, however, the E39 is a good car. Until his death, my great-uncle enjoyed his 523i from approx. 1996/1997, which he bought second-hand (approx. 2000/2001) and with about 150,000 miles at the end never had any problems except wear and tear, age related. The car is still driving, I saw it again the other day.