If I was in the market for a project e39, I would consider a good condition 523 se if it was cheap, and fit an M50 manifold, 528 exhaust (or with some work a 530 exhaust), M-sport it up and enjoy it I don't think the 520 M54B22 is easy to tune.

Having said that, if you weren't going to mod it, as Aivis said it wouldn't make sense to buy the 523 as it would be the same power out of the box althought the 520 would have a little less torque.

Dunno why I never hear of anybody fitting m50 / 528 exhaust on e39 523s though??? :/