The index fund didn't always win. In about a third of those 10-year periods, paying down the mortgage produced a better return. But it's worth noting that when prepaying had the edge, it was a small one, ranging from a meager $1 to $2,799. When the fund beat out prepayment, it did so by $70 to $16,763.