Should I pay for condo with margin loan or sell stock and pay capital gains?

Trying to figure out the best move here. I found a condo I want to buy as a rental property and I have enough in my brokerage to cover it, but most of my positions are sitting on big unrealized gains. My broker is offering a margin loan at around prime plus a couple points. The alternative is selling the stock, taking the capital gains hit on Schedule D, and buying the condo clean. I've held most of these positions over a year so they'd be long-term. I ran some rough numbers but I keep going back and forth. The margin interest deduction adds another wrinkle — I know you can deduct it against net investment income but I'm not totally clear on the mechanics. Has anyone actually done this comparison for a real purchase? Is pay for condo with margin loan or sell stock and pay capital gains really just a math problem or are there other tax angles I'm missing?

36 comments

I dealt with almost this same decision last year. Before I did anything I uploaded my brokerage statements and a draft of what I was planning to sell to taxr.ai and it mapped out the short-term vs long-term split, flagged two positions that would have triggered wash sale issues if I rebought within 30 days, and drafted a holding-period summary I could hand to my CPA. That saved me from a mistake on one position I thought was long-term but wasn't. On the margin interest deduction: it goes on Form 4952 and the deductible amount is limited to your net investment income for the year. Any excess carries forward. So if your investment income is low in the year you buy, you might not get much of the deduction that year.

Wes L.

Author

Thanks, that's the Form 4952 piece I was fuzzy on. So the carryforward is indefinite? And does rental income count as investment income for this limit or is it passive?

Rental income is generally passive income, not investment income for Form 4952 purposes. Net investment income for that form is things like dividends, interest, and capital gains — not rental. So if your main income in the year of purchase is rental and wages, your deductible margin interest could be very limited that year.

Wes L.

Author

That's a problem I didn't see coming. So I could be carrying that deduction forward for years if I don't have much investment income.

Exactly. The carryforward is indefinite but it only unlocks when you have enough net investment income. Worth modeling out a few years before deciding.

Are your long-term positions all in a taxable account or do you have any in an IRA? Selling inside a traditional IRA doesn't trigger capital gains but you can't use those funds directly to buy real estate outside the IRA without a distribution, which has its own tax consequences. Just want to make sure we're talking about taxable brokerage shares.

Wes L.

Author

All taxable brokerage, no IRA involved. The positions I'd sell are plain equities held over a year, so long-term capital gains rates would apply.

Have you looked at which specific lots you'd sell? Even within long-term positions the gains vary a lot by lot depending on when you bought. If you use specific identification (spec ID) you can pick the highest-basis lots first and reduce the gain you recognize. Your broker should let you specify this before the trade settles.

Wes L.

Author

I do have spec ID set up. Some lots from the same ticker have wildly different bases so that actually could cut the gain by a decent amount.

Worth calculating lot by lot. And remember the holding period starts the day after the trade date, not the settlement date, so double-check any lots you think are right at the one-year mark.

The margin loan route isn't free of tax complexity either. If your portfolio drops and you get a margin call you might be forced to sell at the worst time, and that sale could be a short-term gain depending on which shares the broker liquidates. Do you have control over which lots get sold in a margin call situation?

Wes L.

Author

Honestly I don't know. I should ask my broker. I assumed I'd pick the lots but maybe in a forced liquidation they just grab whatever.

Margin interest is only deductible against net investment income, as others said, but you can elect to treat long-term capital gains as investment income to free up more deduction. The catch is that gain then gets taxed at ordinary rates, not the lower long-term rate. So you'd be giving up the preferential rate to unlock the deduction. That trade-off rarely makes sense unless your ordinary rate isn't much higher than your capital gains rate.

Didn't know you could make that election. Where does that actually get made?

It's on Form 4952 itself. The instructions walk through it. But run the numbers first — it usually only pencils out in specific situations.

What's your approximate unrealized gain as a percentage of the position value? That's the key input for the sell-and-pay-taxes route. If you're sitting on 80% gains across the board, the tax drag is huge and the margin loan looks better even at a high rate. If you're at 20% gains, selling is probably cleaner. I had Taxr go through my brokerage year-end summary and it calculated the effective after-tax proceeds for each lot and ranked them — so I could see which ones were cheapest to sell from a tax standpoint. Really useful when you have a dozen positions.

Wes L.

Author

Gains vary a lot by position. Some are 15% unrealized, some are over 200%. That's why I can't just say sell everything — the high-gain ones are brutal to exit.

For the high-gain ones, the margin loan lets you keep the position and defer the gain indefinitely (or until you have a plan to offset it). The borrowing cost is the price of deferral. Some people think of it that way.

Does your state have its own capital gains rate on top of federal? In some states long-term gains are taxed as ordinary income at the state level, which changes the sell-side math significantly. The federal preferential rate is only part of the picture.

Wes L.

Author

Good point, yes my state taxes long-term gains as ordinary income. So I need to stack the state rate on top of the federal long-term rate when I calculate the true cost of selling.

One angle people overlook: if you hold the appreciated stock until death, your heirs get a stepped-up basis to fair market value at the date of death under Publication 551's rules for inherited property. So the embedded gain effectively disappears. If the condo purchase isn't urgent, keeping the stock and using margin buys time — though obviously nobody plans their death around tax strategy. I had a complicated situation with a mix of gifted stock (where my basis was the donor's basis) and long-term positions. I gave all of it to Taxr and it sorted out which lots had gain-basis vs loss-basis under the gift rules and flagged which ones I'd recognize neither gain nor loss on if sold between the two bases.

Wes L.

Author

The stepped-up basis angle is real but I'm not planning around that. The gifted stock basis rules are a whole other headache — glad you got that sorted.

Have you modeled the break-even? Like, at what margin rate does the annual interest cost equal what you would have paid in tax by selling? That's the core comparison. If the tax cost of selling is a one-time hit and the margin interest is ongoing, eventually the loan costs more cumulatively than the tax would have.

Wes L.

Author

I started a spreadsheet but I keep second-guessing my assumed after-tax rate of return on the stock. It's the hardest input to nail.

Yeah there's no clean answer there. Some people use a conservative expected return and see if the margin math still works under that assumption. Stress-testing a few scenarios is probably more useful than a single number.

Are you planning to pay off the margin loan with rental income over time, or would you hold the loan until you sell the condo? The exit strategy matters for how long you're carrying the interest cost and whether the Form 4952 carryforward ever gets used.

Wes L.

Author

Probably a mix — some rental income applied to it, and I'd pay it down faster if the stock appreciates and I sell other positions with lower gains to free up cash.

What about the net investment income tax on top of regular capital gains? Depending on your modified adjusted gross income, you could owe an additional 3.8% on net investment income including capital gains. The instructions for Form 8960 cover how that's calculated. Worth checking whether you'd be in that territory before you assume the long-term rate is your only federal rate.

This is a real factor at higher income levels. The Form 8960 threshold depends on filing status — the instructions have the exact amounts. Combined with state tax it can make the effective rate on a sale notably higher than the headline federal rate.

Is there any chance you'd sell the condo within a few years? If you buy it with a margin loan and later sell the condo to pay off the loan, you're still sitting on the unrealized stock gain. Some people get into a situation where they've used the proceeds of the sale to pay debt but haven't solved the tax deferral — they just moved from one liability to another.

Wes L.

Author

That's a good point. If I sell the condo I'd probably also sell some of the stock at that point to pay down the loan fully, so the gains come due then anyway. Just delayed.

The wash sale rules are worth keeping in mind if you sell a position at a loss to offset some of the gain from the lots you sell at a gain. If you sell at a loss and buy back a substantially identical security within 30 days before or after, the loss is disallowed and gets added to the basis of the new shares instead. The 30-day window applies on both sides of the sale.

And the wash sale can be triggered in an IRA or Roth IRA too — if you sell in your taxable account and buy substantially identical shares in an IRA within that window, the loss is still disallowed. The difference is the disallowed loss does not get added to the IRA's basis in that case, it's just gone.

Right, the IRA version is especially painful because you lose the loss permanently with no basis offset to recover it later.

Since this involves a rental property and an ongoing margin loan, there are enough moving pieces — Form 4952 carryforwards, lot-by-lot basis tracking, possible net investment income tax, state treatment — that having a CPA or enrolled agent run the full multi-year comparison is probably worth the cost before you commit. The tax picture in year one can look very different from years two through five depending on how the rental income and stock positions develop.

Wes L.

Author

Agreed. I've been trying to DIY the analysis but I think I need someone who can model it over several years with the actual numbers. This thread gave me the right questions to bring to them — especially the Form 4952 limit, the lot selection, and the wash sale timing if I do partial sells.