The S38 is regarded as a race-derived, exceptionally durable engine routinely seen with 175K-300K+ miles, but a proper rebuild costs $15-20K and is the largest looming expense for buyers.
S38 engine longevity and rebuild costs
BMW E28 M5 · mechanical