True with two caveats...   taxes and risk.    

 Outside of your registered funds you are paying taxes on those returns (cap gains and dividends).  You are paying your 3% mortgage with after tax dollars.   (essentially making a 3% return on funds invested in that mortgage balance)   Paying off your 3% mortgage  provides a risk free return of 3%.  

So to do the same in the market you would need a risk free portfolio - that returns more than 3% after all taxes.    That's tough to do these days....

The moment you introduce risk in your alternative portfolio you are now making an unfair comparison between the value of paying your mortgage down versus an alternative investment portfolio.