Sec. 872 Gross income
(a) General rule. In the case of a nonresident alien individual, except where the context clearly indicates otherwise, gross income includes only--
(1) gross income which is derived from sources within the United States and which is not effectively connected with the conduct of a trade or business within the United States, and
(2) gross income which is effectively connected with the conduct of a trade or business within the United States.
(b) Exclusions. The following items shall not be included in gross income of a nonresident alien individual, and shall be exempt from taxation under this subtitle:
(1) Ships operated by certain nonresidents. Gross income derived by an individual resident of a foreign country from the international operation of a ship or ships if such foreign country grants an equivalent exemption to individual residents of the United States.
(2) Aircraft operated by certain nonresidents. Gross income derived by an individual resident of a foreign country from the international operation of aircraft if such foreign country grants an equivalent exemption to individual residents of the United States.
(3) Compensation of participants in certain exchange or training programs. Compensation paid by a foreign employer to a nonresident alien individual for the period he is temporarily present in the United States as a nonimmigrant under subparagraph (F), (J) or (Q) of section 101(a)(15) of the Immigration and Nationality Act, as amended. For purposes of this paragraph, the term "foreign employer" means--
(A) a nonresident alien individual, foreign partnership, or foreign corporation, or
(B) an office or place of business maintained in a foreign country or in a possession of the United States by a domestic corporation, a domestic partnership, or an individual who is a citizen or resident of the United States.
(4) Certain bond income of residents of the Ryukyu Islands or the Trust Territory of the Pacific Islands. Income derived by a nonresident alien individual from a series E or series H United States savings bond, if such individual acquired such bond while a resident of the Ryukyu Islands or the Trust Territory of the Pacific Islands.
(5) Income derived from wagering transactions in certain parimutuel pools. Gross income derived by a nonresident alien individual from a legal wagering transaction initiated outside the United States in a parimutuel pool with respect to a live horse race or dog race in the United States
(6) Certain rental income. Income to which paragraphs (1) and (2) apply shall include income which is derived from the rental on a full or bareboat basis of a ship or ships or aircraft, as the case may be.
(7) Application to different types of transportation. The Secretary may provide that this subsection be applied separately with respect to income from different types of transportation.
(8) Treatment of possessions. To the extent provided in regulations, a possession of the United States shall be treated as a foreign country for purposes of this subsection.