Because if you have several hundred thousand dollars laying around to pay in cash, you’re better off investing that into an index fund which will have a higher rate of return than the interest on the mortgage.
If you have $500k and want to buy a $500k house, you could pay the entire $500k down and own the house free and clear, but you would only gain the appreciation on the house if you ever sell it. Assuming doubling in value every 10 years it should be worth $4M after 30 years.
If you had $500k and took out a mortgage of $400k, at the national average of 7% and 30 years, you would pay a total $1,033,654. If you took the other $400k you had and put it in just the S&P 500 which has averaged right at 10% annually, and left it there, you would end up with $6,979,760 in that fund at the end of the 30 years.
So you would come out ahead by about $4 million at the end if you took the mortgage and invested the cash.
If you have a mortgage, 99/100 the bank is going to make you pay into escrow for insurance and taxes.
This is just a simple online mortgage calculator so it’s not factoring in that you could just pay those yourself if you’re paying all cash for the house.
They can be or they can be paid through "escrow" and your mortgage servicer will pay them.
Usually sites like these want to show total monthly cost though, so they tend to include estimates for property taxes and insurance in the monthly payments. Whether it gets paid through your mortgage servicer or directly by you doesn't change much.
It can be paid directly by you, or it can be held "in escrow" and paid by your lender. Ultimately it doesn't make a difference financially, but it does mean logistically you either are paying one bill vs 3+.
It also comes at the risk that your lender fucking up could result in, best case scenario, a paperwork nightmare and maybe a small fee with your insurance/county/whatever, worst case scenario, the cancellation of a policy you may or may not be able to get back into easily.
Online calculators almost always include, or have an option to include, these costs. In part it's because that's the number the bank will use to determine what you qualify for. Makes it much easier to say, "here's your monthly obligation" and compare that to you monthly income, instead of "here's your monthly obligation, and here's your twice-a-year tax obligation."