I had a 2002 525d for two years. Maintenance bill can be high, injectors, turbo, Suspension are big offenders and can be very costly. Even general maintenance servicing etc is costly compared to petrol variants. My advice you would try to get one with up to date service history if you can. The vast majority with 150k+ miles will need major work if not done already, but can vary from car to car. It depends really how it was treated throughout its life.

Mine gave very little trouble but was extremely well looked after by previous owners (a very thick book of receipts came with it ). They are fantastic car and very rewarding to drive. Also I think most touring e39's came with air self leveling suspension on the rear but I could be wrong, I would a imagine a big bill if it were to fail.

I'm sure other people might have different experiences.

Hope this helps (I wrote it in hurry)