Renting vs buying comparisons need to account for lot more than those two numbers but that's all I see posted most of the time.
"Realtor costs" are again different some estate agents in the UK charge a % of the sale price others a minimal fixed cost.
I'm sure that these things differ massively in different countries as well so it's hard to put an average number on that.
In terms of opportunity cost of the money again it depends on how you would invest that money you could put it in something very high risk and show a huge imbalance in buying a home vs investing in crypto or something like that. In the UK most low risk savings accounts will track lower than inflation on a property only the stock market will track higher but again that's higher risk and so not comparable. Also most savings accounts in the UK are capped at a max amount that can be saved per year.
As I said though if you try to compare mortgage vs something like stock market it's not really comparable. Also to note the large index funds in the USA track much higher on average than most other countries.
I've seen people use the S&P as an example that house prices don't track to the same amount and that you can compound any gains to make large sums of money. What's interesting about this is that the reason you make so much money with that model is that compound interest is non-linear in growth which means over say 40 years you make most of the growth at the end of the period (Literally in the last 20%). This also means that if the end of your growth curve ends on a bad few years for the S&P you'll do much worse than the average so the risk is still very high on even index funds.
Overall though my current mortgage cost is 2.5 x lower than rent for a comparable property. So you'd have to factor in the opportunity cost of that extra per month I save not paying into rent into your equation as well.
Not always, in some EU countries, some rental agreements have the tenant pay for certain maintenance, plus insurance.
The big unpredictable element is home repair costs.
This is generally true because prices generally go up. My brother almost bought a $200K condo in SF 30 years ago but it was slightly out of reach on his $60K Sun micro income, and his $500 room for rent was cheaper. The condo has gone up about 8X and rent (assuming market rate, it was under rent control) 5X. So as expensive as it is to rent in SF, it’s relatively more expensive to buy. It’s unknown if that trend will continue. It doesn’t seem rational but the city seems intent on continuing to severely restrict supply.