Petrol or diesel?
Beemers, like any engines, are good for as long as they are looked after (within reason, I wouldnt say go past 180,000 miles for a petrol lol)
You can buy a screwed up engine that has only done 45,000 miles for instance, simply because the owner has never looked after it, its been a dodgy one from the start, or its been ragged.
My old Pug had 163,000 on the clock when I sold it - the engine itself was an absolute dream - granted the clutch wasnt the best ever, probably only had a year left in it, but the engine itself was a lovely drive.
As the mileage goes higher, its the car around the engine that tends to wear, so long as the engine has been looked after. Take it for a test drive, look for service History
, if the engine feels nice and runs smooth, check the ancillary components, the clutch, the bodywork etc...
I think Joe and Stuy will be able to offer more direct advice with regards BMW engines, mine is very general.