I used to ride with this bloke who bought a custom made titanium roadie for $10,000 - about 4-5 years ago. I was shocked when I heard the price tag as I used to spend at most $1000 on a roadie - back then i didn't know what mtb is. When I asked how can u justify such a huge amount just for a roadie, he said easy. My wife is having a nice holiday to see her family back in South America, I don't want to come along, so I said that means I can spend the money on a new roadie. I was given a budget of $10,000 so I'll spend it all.
The point is, as others have pointed out, there are many (in various financial capacity) who are willing to spend big money on bikes - road or mtb. This drives up the price under the mentality we can charge whatever we want as there will be people willing to pay for it and influence others to do so.
Oh don't forget as well, we need to inflate the price to pay for marketing in whichever forms