Ignoring risk, evaluating the financial benefits and costs of home ownership (as opposed to renting) isn't simple, but it is straightforward: just an application of computing net present value Net present value using your expected investment returns as the discount rate. As an example, see this spreadsheet.
The complexity arises when we realize that taking a mortgages is equivalent to leveraging your investments, which necessitates increasing your investment's risk.
Recall that the cost of investment grows linearly with risk Markowitz. For instance, if you borrow 1% of your net-worth, your risk increases by ~1%.
The complexity mainly comes borrowing higher amounts. For instance, if you borrow 70% your net-worth, then you run into a very real possibility of losing everything.