An organization operated for the primary purpose of carrying on a trade or business for profit shall not be exempt from taxation under section 501 on the ground that all of its profits are payable to one or more organizations exempt from taxation under section 501.
(1) the deriving of rents which would be excluded under , if section 512 applied to the organization,
(2) any trade or business in which substantially all the work in carrying on such trade or business is performed for the organization without compensation, or
(3) any trade or business which is the selling of merchandise, substantially all of which has been received by the organization as gifts or contributions.