Things to look for:
1. Remove the wheels, and hold the rim while spinning the axle between your fingers. Rough rotation or play could mean pitted cones and races - which means you need new wheels.
2. Check spoke tension. If some are vastly higher than others, the rim might might be in pretty bad shape - which means you'll be perpetually fiddling with it to keep it in true, and probably end up buying a new wheel.
3. Check the teeth on the cranks and cassette. A new set of chainrings and cassette could add $150 or more to the cost of the bike. This is a lot.
4. Check the fork. I don't know much about MTB forks, but I do know that almost all designs have the potential for irreparable damage over time.