From the OP:
Did I do the math right? If so, it looks like I made a very bad decision!
Since you asked if you did the math right, let me address that, and skip the never-ending debate of 'feel good' vs 'might have made more money'.
So no, I don't think you did the math right (but it doesn't matter much for a few reasons).
First - simplify your calculation - the house appreciates or depreciates the same amount, whether you have a mortgage or not. That's a wash, it's the same calculation in each case - so just skip it. Now, if you purchased that house strictly as an investment (not a primary residence that you'd need to replace when you sold, and would probably need to pay more for the new house anyhow), then you could look at a mortgage as leverage and would have a higher rate of return on your investment. But this is your home, I don't think any of that applies or matters.
Second - Don't count the entire mortgage payment as an 'expense', some is going to principal, that's really just moving money from one account to another - it's still your money.
Third - other than just analyzing what happened in the past as an exercise (you can't do anything about it now), there is no value to it. It's a bit like saying
"I bought a lottery ticket and won, so buying lottery tickets is a good idea." - No, on average you expect to lose with a lottery ticket, it's never a good idea. The occasional winner doesn't change the decision process.
Here is how I think the calculation and decision process should go:
A) What is the interest rate and term on the mortgage?
B) Compare this to historical market returns for that time period.
I got a 30 year mortgage @ ~ 3% in 2021. Here's a chart that shows the 30 year rolling returns for the market. You will see that the market's WORST performance was ~ "The lowest
annual return over any 30 year period going back to 1926 was 7.8%. ... —
the worst 30 year return over the past 100 years or so was a total gain of 850%."
An eyeball of the average looks to be ~ 10%.
A look at the historical long-term returns for the U.S. stock market.
awealthofcommonsense.com
So, my viewpoint was, if I can get a 3% mortgage, and the historical very, very, WORST market return was over twice that, well that sounds like an offer too good (for me) to refuse. So I took it.
Pretty much every investment decision we make has an element of risk/reward to it. Even something like CDs have interest rate risk. When I see a risk reward ratio like that, I see opportunity knocking.
One could also have the view that even with that knowledge, there is still a chance that the market could perform way worse than the worst of the past. And they'd be right, it
is possible. So if that bothers you, don't do it. But I wonder how they make ANY financial decision, if they can't bite at this one? Money in your mattress is losing to inflation.
So to me, "how did I do for 5 years?" is not a valuable question. The market might have gone down in that time, I would not consider my 3% mortgage to be a "bad decision" - that will be determined over the life of the mortgage. History gives me a LOT of confidence this was a good decision (I should leave notes for my heirs, they will be the real beneficiaries!). And if it wasn't, I doubt it will be "bad" by very much, and that is a risk I am very, very willing to take.