I'm into mountain biking and it's fucking criminal what they charge for bike prices these days. A good bike with decent quality components is like $5000-$7000. High end name brand components will bring that up to $9000 easily. Higher end frames and boutique components can bring it into the $11000-$15000 range. It's fucked lol.
Oh and for an electric bike add $2000-3000 to the price.
Building an ebike is way cheaper than buying one, but off the shelf mid drive stuff from Bafang, etc is generally not as high quality as Shimano, Bosch, TQ, etc. I've got a Bafang mid drive bike that's crazy powerful with 2300w, but it's heavy as hell and very loud/not super refined. My TQ bike is 25 pounds(!) lighter and while it only has 300w of power, the power delivery is incredibly natural and responsive, and the bike feels more like an actual mountain bike to ride on trails instead of like a motorcycle lol.
Yeah it's honestly too much lol it destroys cassettes really quickly đ but it can almost go 40 mph on the street. This is an M620 with an Innotrace controller.
Your notion of "decent" is certainly not the same as 99.99% of the population. Or you live in a very expensive place and have a very specific use of mountain bikes.
Yes my notion of "decent" is skewed because I'm doing 3000 foot climbs/descents on highly technical and fast trails with drops, jumps, rock rolls, wet roots, etc. You can ride those on a $500 Walmart bike but you might not survive it lol. There's deals to be had, direct to consumer bike brands are considerably cheaper (like $1000 cheaper in general I'd say) and there's obviously more budget oriented options, but their performance, longevity, and weight are typically not as good.
I was going off of a ballpark average of what I've been seeing in media and bike shops over the last couple of years. Seems like every mountain bike even with lower end components is $5k+ these days, but media tends not to cover cheaper stuff because it's not as interesting.