Tax free capital gain from the US during NHR window, too good to be true?

So here is a wishful scenario that I’ve conjectured up in the shower and I am hoping people can poke holes in it —

Hypotheticals

  • I currently own stocks or stock options in a private company in the US. I am an employee of the company, working in a directorial/managerial capacity.
  • I am currently legally residing in the US, but not a citizen of the US.
  • I’ve gotten my GV and my NHR at year 0.
  • I’ve been living in the US for the past 12 years but after I got my GV, I decided to pack up all my stuff and move to Portugal at year 0.
  • Subsequently, I continue to work for my existing company remotely in PT as an independent contractor, earning regular “wages” or payment to my invoices whatever you want to call it.
  • I carefully plan my visit to the US so that I will FAIL the Substantial Presence Test during the NHR window.
  • In year 6, I dispose of my stock holdings and/or exercise my options, yielding 100 million dollars in net proceeds.

Wishful Thinking
Is my 100 million dollars tax-free as far as cap gain is concerned from both Uncle Sam and PT government?

Thanks for your help in advance.

P.S. I am also consulting with tax lawyers but starting with some crowd-sourced intel and open questions.

Do you have a green card? If so you may have to pay exit tax when leaving the US.

Otherwise can’t you just reside in any tax haven and pay no capital gains? Why Portugal?

No don’t have one.

I need a good passport so that’s why I am going to Portugal.

My limited understanding[1] of how capital gains are taxed under NHR depend upon the existance and nature of a double tax treaty with the country where you are subject to taxes on the sale of shares.

If there is such a treaty, capital gains are tax exempt in Portugal, according to euroFinesco’s free document s49 - Non-Habitual Residence Tax Regime.
https://www.eurofinesco.com/en/our-publications/nhr

Without such a treaty, capital gains can be treated in Portugal as ordinary income. Because of their progressive tax rates, it’s better to choose the optional rate of 28% on capital gains.

The euroFinesco docs on capital gains don’t mention NHR. GlobalCitizenSolutions explains them both with and without NHR.
https://www.eurofinesco.com/en/our-publications/cgt

Because I’m a US citizen, I have close to zero knowledge of how the US taxes non-citizens.

[1] I will confirm this with my tax accountant before selling shells producing a non-trivial amount of capital gains.

With large amounts be very careful with how you do this. You may be subject to the alienation clause of the US Portugal tax treaty. In other words subject to EU capital gains when you transfer the assets to the US.