If a domestic corporation which is or has been a United States real property holding corporation (as defined in section
897
(c)(2)) during the applicable period specified in section
897
(c)(1)(A)(ii) distributes property to a foreign person in a transaction to which section
302 or part II of subchapter C applies, such corporation shall deduct and withhold under subsection (a) a tax equal to 10 percent of the amount realized by the foreign shareholder. The preceding sentence shall not apply if, as of the date of the distribution, interests in such corporation are not United States real property interests by reason of section
897
(c)(1)(B). Rules similar to the rules of the preceding provisions of this paragraph shall apply in the case of any distribution to which section
301 applies and which is not made out of the earnings and profits of such a domestic corporation.