If you carefully read the IRS documentation, you’ll see that what matters is *where you physically are while performing the work*, regardless of who you are performing the work for. If you are working for a US company remotely, you will still owe social security and medicaid (15.3% total, half paid by your employer) on the first ~128k I think, but you will owe no income tax on the excluded amount (~106k). This basically means that on a $100k salary you’ll pay approximately $7500/yr to the US while living in Panama.
The Panama tax authorities take the opposite view — to them it matters not where you are while performing the work, but whether or not the income comes from Panama territory.
Basically you get the best of both systems — Panama doesn’t care about money from outside of Panama, while the US doesn’t care about work done while outside of Panama.
Hope this clears things up.