Investors & landlords

The IRS rules say heloc int can be deducted if used to buy, repair, or improve property it is secured by. How would you use a heloc to buy the property you already have a heloc on. I believe a heloc can be used and deducted for down payment funds on your primary residence.