The two tax regimes, and why the difference is so large. Section 872(a) limits a nonresident alien's gross income to two buckets: US-source income that is not effectively connected with a US trade or business, and income that is effectively connected. Section 871 then taxes them on completely different principles.
The first bucket is taxed under section 871(a)(1) at a flat 30 percent of the gross amount received, on a list that begins "interest, dividends, rents, salaries, wages, premiums, annuities, compensations, remunerations, emoluments, and other fixed or determinable annual or periodical gains, profits, and income." Tax practice shortens that to FDAP. Gross is the operative word: section 873(a) allows deductions only against effectively connected income, so no expense, no loss and no basis reduces a FDAP amount. A $1,000 US dividend produces $300 of tax whether the recipient is wealthy or destitute.
The second bucket is taxed under section 871(b)(1) "as provided in section 1 or 55" on taxable income that is effectively connected with the conduct of a US trade or business. That means the ordinary graduated brackets, and it means deductions connected with that income are allowed. Section 873(b) adds three deductions allowed regardless of connection: casualty and theft losses on property located in the United States, charitable contributions, and the personal exemption allowed by section 151. The third is currently worth nothing to anyone: section 151(d)(5) sets the exemption amount at zero for tax years beginning after 2017, so in practice the exception carries the first two.
Withholding is the collection mechanism, and it is set at the statutory rate. Section 1441(a) requires any person with control or custody of a US-source FDAP payment to a nonresident alien to "deduct and withhold from such items a tax equal to 30 percent thereof." The payer, not the recipient, carries that duty, which is why a US broker withholds on dividends before they reach a foreign account. A recipient claiming a lower treaty rate has to certify foreign status and treaty eligibility to the payer, for an individual on Form W-8BEN, Certificate of Foreign Status of Beneficial Owner for United States Tax Withholding and Reporting. Without the certificate the payer withholds at the full rate.
Capital gains are the strange case, and the rule surprises people. A nonresident alien is generally not taxed by the United States on gains from selling US stock. But section 871(a)(2) imposes the 30 percent tax on net US-source capital gains for "a nonresident alien individual present in the United States for a period or periods aggregating 183 days or more during the taxable year." So the same trade is untaxed for someone who visited briefly and taxed at 30 percent for someone who spent most of the year in the country without becoming a resident. Gains on US real property interests are governed by a separate regime and are not covered by this rule.
The portfolio-interest exemption removes most US-source interest from the tax. Section 871(h) disapplies the section 871(a) tax for interest that meets its conditions. The interest must be paid on an obligation in registered form, and the payer must generally receive a statement that the beneficial owner is not a US person. The exemption does not reach interest received by a 10-percent shareholder of the issuer. This is the reason foreign investors can hold US bonds without a 30 percent haircut on the coupons while foreign investors in US stocks cannot avoid withholding on dividends the same way.
US rental income has an election attached to it. Rent is FDAP, so by default a nonresident alien landlord is taxed on 30 percent of the gross rent with no deduction for the mortgage, the property tax, repairs or depreciation. Section 871(d) lets the individual elect to treat income from US real property held for the production of income as effectively connected, in which case it "shall be taxable as provided in subsection (b)(1) whether or not such individual is engaged in trade or business within the United States." That moves the rent to the net-basis, graduated-rate regime with deductions. The election stays in effect for later years unless the Secretary consents to a revocation, and section 871(d)(2) then bars a new election before the fifth taxable year beginning after the first year for which the revocation took effect, absent the Secretary's consent.
The filing consequences are a short list of hard bars. Section 63(c)(6)(B) sets the standard deduction at zero for a nonresident alien. Section 6013(a)(1) provides that "no joint return shall be made if either the husband or wife at any time during the taxable year is a nonresident alien." Section 2(b)(3)(A) provides that a taxpayer is not head of household "if at any time during the taxable year he is a nonresident alien." The return itself is Form 1040-NR, US Nonresident Alien Income Tax Return. A treaty can override individual pieces of this, and there is a separate route for a couple in which one spouse is a nonresident alien to elect resident treatment for both, which belongs to the resident alien side of the line.
Status can change mid-year, and the two halves are taxed separately. Section 7701(b)(2) sets residency starting and ending dates, so a person who arrives or leaves partway through a year is a nonresident alien for part of it and a resident for the rest. That produces a dual-status year, in which the nonresident portion is taxed under section 871 and the resident portion under the ordinary rules.