Those aren't the sort of bikes that people buy in order to lose weight. They are more like mini MotoX bikes without the engines. They cost a lot because they are built to be extremely strong and have brakes which work well at high speeds in bad conditions which is important when you smash it into a tree at 40mph.
The risk with buying a bike like that second hand is that it may have already been crashed/damage.
I have some insight in the 'new bike sale' process for brand bikes. The margins are very healthy. I buy 'regular' bikes brand new and I won't argue about the price, the margin on those is a lot lower.
The margin on high end (road/mountain) bikes is insane and their performance is not substantially different from last years issue (which can be already had at a subtantial discount new), second hand ones are much more realistically priced.
If you feel like overspending and/or justifying that then be my guest but there is no rational reason why last years model should be worth half of what this years model is worth.
That's why there are 'model years' in the first place, they are simply a device for getting you to upgrade, this suggests that there is a lively second hand market where you can find something of almost the same functional value for a small fraction of the new sticker price.
In that second hand market you will find bikes that have been used heavily in that first year and bikes that are 'good as new' and the prices won't be too far apart, usually around 40-50% of what a new one costs.
For instance, this bike is $6600 new but discounted to $2495
You'd need to inspect it and make sure that it is really 'only a scratch' rather than that it has impact damage but that's doable if you know what you're buying. And if you don't then you do not have a good reason to spend more than $1000 on a mountainbike anyway. (The difference between a $1000 second hand bike and a new one that's 5 times as expensive are still not large enough to justify the difference in price).
Craigslist is another good source for hardly used bikes at a fraction of their new price.
As for impacting stuff at 40Mph, your carbon bike will be bits and pieces at those speeds, an aluminum bike will be still in one piece but ready for the shredder.
If your main concern is impact damage to your bike then you have been very lucky so far. In my opinion the main risk in mountainbiking down-hill with trees next to the track is impact damage to the rider, not the bike.
Just be aware that second hand bike generally have no warranty on the frame. That may or may not be a concern. If you know what you are after getting a bike second hand and getting the parts off it can be a great way to get exactly what you want.
I'd also point out that you can get really good deals on bike when the model year changes over.
(I only do road bikes, but I'm sure it's pretty similar for MTBs).
Mountain bikes are never in a new condition for long if ridden regularly. You are going to crash it sooner or later and you need to check for damage regularly. A lot of the parts will need overhauling or replacing within 6 months. A well maintained 2 year old bike can be in better condition than a badly maintained 6 moth old one.
There is hardly a bike frame on the market that can survive actually hitting a tree at even 10mph with the rider on it.
Most of the frames are extremely strong vertically, but if impacted on the side or directly on the tubes crumple like the couple mm thick aluminum/carbon they are.
At the world cup finals in Hafjell, Norway last weekend, the top guys were hitting 82 kmh (51 mph~) on a open section speed trap. They aren't quite as fast in tighter sections, but still plenty fast.
Here is the helmet cam footage of Josh Bryceland that probably would have ended up winning if he had not overshot the last jump and broken his foot. https://www.youtube.com/watch?v=XBDpu4-pQhM The speedtrap is at about 2:30.
The risk with buying a bike like that second hand is that it may have already been crashed/damage.