A foreign corporation engaged in trade or business within the United States during the taxable year shall be taxable as provided in section 11, 55, or 59A, on its taxable income which is effectively connected with the conduct of a trade or business within the United States.
In determining taxable income for purposes of paragraph (1), gross income includes only gross income which is effectively connected with the conduct of a trade or business within the United States.
In the case of a foreign corporation, the deductions shall be allowed only for purposes of subsection (a) and (except as provided by subparagraph (B)) only if and to the extent that they are connected with income which is effectively connected with the conduct of a trade or business within the United States; and the proper apportionment and allocation of the deductions for this purpose shall be determined as provided in regulations prescribed by the Secretary.
The deduction for charitable contributions and gifts provided by section 170 shall be allowed whether or not connected with income which is effectively connected with the conduct of a trade or business within the United States.
A foreign corporation shall receive the benefit of the deductions and credits allowed to it in this subtitle only by filing or causing to be filed with the Secretary a true and accurate return, in the manner prescribed in subtitle F, including therein all the information which the Secretary may deem necessary for the calculation of such deductions and credits. The preceding sentence shall not apply for purposes of the tax imposed by section 541 (relating to personal holding company tax), and shall not be construed to deny the credit provided by section 33 for tax withheld at source or the credit provided by section 34 for certain uses of gasoline.
Except as provided by section 906, foreign corporations shall not be allowed the credit against the tax for taxes of foreign countries and possessions of the United States allowed by section 901.
Paragraphs (2) and (3) of section 871(d) shall apply in respect of elections under this subsection in the same manner and to the same extent as they apply in respect of elections under section 871(d).
If any foreign corporation has no office or place of business in the United States but has an agent in the United States, the return required under section 6012 shall be made by the agent.