It's not only legal for a nonprofit to set up a for-profit subsidiary, sometimes it's necessary. Your nonprofit can legally engage in money-making activities, but if the activities aren't related to your core purpose, that can jeopardize your tax status. Spinning the money-maker off into its own company protects you.
If an art museum sells reproductions of famous paintings or a hospital markets disease-tracking software, those projects tie in to the core mission. Even so, too much profit-making activity could trigger an IRS crackdown on your nonprofit status. The IRS doesn't spell out how much is too much, but creating a separate for-profit business avoids the problem. Founding a new business also protects the nonprofit from legal liability for the money-making ventures. It may encourage investors to take the business more seriously as it isn't a charity.
Setting Things Up
To gain the best deal on taxes, most nonprofits set up the subsidiary as a C corporation, in which the nonprofit owns some or all of the stock. A nonprofit can also enter a partnership or become an owner of a limited liability company. The subsidiary pays taxes like any other for-profit business, but the parent nonprofit's dividends are usually tax-free. A nonprofit has to move carefully as there are many ways this arrangement can go south. The IRS, for example, has held that if the nonprofit and the for-profit have identical boards of directors, they aren't really separate.