How this is calculated
Both paths start with the identical cash: your down payment, closing costs and rehab money. The property path runs a real landlord's year, every year of the holding period: rent grows and a vacancy discount is applied, then property tax, insurance, maintenance and management costs (each a percentage of the CURRENT home value or rent, so they grow with the property) are subtracted, then the mortgage payment. What's left is cash flow - and it's taxed or sheltered honestly: mortgage interest and straight-line depreciation (structure value ÷ 27.5 years) reduce taxable rental income, and losses offset up to $25,000 of your other income before phasing out between $100,000 and $150,000 of it, exactly like the IRS passive-activity rules. The index-fund path grows the same starting cash at your expected return - and whenever the property needs extra cash in a bad year, the index path gets that same extra contribution too, so neither side is unfairly starved of capital.
depreciation/yr = (price × building %) ÷ 27.5 · taxable rental income = rent collected − operating costs − mortgage interest − depreciation
What happens at the end
The property sells at your appreciation rate, minus selling costs and the remaining loan. The gain is split two ways for tax: the depreciation you claimed gets "recaptured" at a flat 25%, and the rest of the gain is taxed at your capital-gains rate - both real IRS rules, not simplifications. Any positive cash flow collected along the way is assumed reinvested in the same index fund (with its own capital-gains tax applied at the end), so a landlord who banks the rent isn't penalized for not having spent it.
The honest tilt
Real estate wins on leverage (you control a $320,000 asset with a fraction down) and on the depreciation shield; the S&P wins on liquidity, zero maintenance calls, and never needing a new roof at 2am. This tool prices the money; it can't price the phone call from a tenant.
Paying cash instead?
Switch "How are you paying for it?" to all cash and the mortgage disappears from both sides of the math: no debt service, no interest deduction, and your full purchase price counted as invested cash. It's the fair comparison for buyers who aren't financing - leverage is what usually tilts real estate's numbers, so removing it changes the answer more than almost anything else here.
Notes
Assumes steady occupancy at the stated vacancy rate (not lumpy real turnover), a constant marginal rate, and a sale at the end of the exact holding period. 1031 exchanges (which defer this sale tax entirely) aren't modeled - if you plan to exchange rather than cash out, the property side understates its result.