Paying a mortgage is paying off debt.
Buying shares is in order to grab a bigger slice of the cake on dividends from the profits.
They're the same thing.
One your buying equity from the lender, the other your buying equity from existing shareholders.