I've had 3 E39s, all with MT. All have been great cars with reasonable maintenance costs. First was a 540-6.
540 was a lot of fun for sure... It's got tons of torque all over. 528 touring is a nice ride too, handling is fine and power is adequate, but the V8s are obviously much more fun. Mileage for the 528 is slightly better than the M5. 11l/100 vs 12l/100 combined.
Definitely take a 540 for a test drive before making this decision. You're welcome to try my two...although I don't have a 540 right now.
E39 528i Touring - Unicorn Package (5 Spd M)
E39 M5 - for Sunny Days