Any corporation, association, trust or community chest, fund or foundation,
organized and operated exclusively for religious, charitable or education
purposes or for the prevention of cruelty to children or animals,
and no part of the net earnings of which inures to the benefit of
any private shareholder or individual and no substantial part of the
activities of which is carrying on propaganda or otherwise attempting
to influence legislation; provided, however, that nothing in this
subsection shall include an organization operated for the primary
purpose of carrying on a trade or business for profit, whether or
not all of its profits are payable to one or more organizations described
in this subsection. Where any organization described in this subsection
carries on its activities in furtherance of the purposes for which
it was organized in which, as part of said activities, it operates
a hotel, occupancy of rooms in the premises and rents therefrom received
by such corporation or association shall not be subject to tax hereunder.