Investors & landlords

If you rent the home out to the person living them, yes, the mortgage interest is a deduction against the rental income that you receive.

When you eventually sell the new house, you can usually 'exclude' (not pay tax on) up to $250,000 ($500,000 if Married Filing Jointly) of the gain.  However, if you are renting it then move into the home after the rental, that $250,000/$500,000 will be prorated based on the time it was your Main Home, versus the total time you owned it.