Can capital gains tax be avoided if it is used to pay off the mortgage on a second home that is turned into a rental?
your question does not make sense. if you are asking if the proceeds from a sale resulting in a capital gain used to pay off a mortgage on a rental property avoids the tax on the sale, the answer is no.
to avoid tax on the gain on sale of rental property you must do a section 1031 exchange. to avoid any taxable gain completely you can not get hold of any of the proceeds from the sale. they must be held by an exchange trustee and must be used to buy other rental property. that are many other rules with regard to a 1031 exchange.
if the sale resulting in the capital gain was your personal residence you can not do a 1031 exchange.