Nonprofit corporations, by definition, exist not to make money but to fulfill one of the purposes recognized by federal law: charitable, educational, scientific, or literary. Under state and federal tax laws, however, as long as a nonprofit corporation is organized and operated for a recognized nonprofit purpose and has secured the proper tax exemptions, it can take in more money than it spends to conduct its activities.
In other words, your nonprofit can make a profit. Whether or not that income is taxable depends on whether the activities are related to the nonprofit's purpose.
Tax-exempt nonprofits often make money as a result of their activities and use it to cover expenses. This income can be essential to an organization's survival. As long as a nonprofit's activities are associated with the nonprofit's purpose, any profit made from them isn't taxable as "income."
Let's take as an example a group called Friends of the Library, Inc. It's a 501(c)(3) (which means it has a federal tax exemption), organized to encourage the appreciation of literature and to raise money to support and improve the local public library. It makes a profit from a lecture series featuring famous authors and from an annual volunteer-run sale of donated books.
Because these activities are educational and literary in nature, they do not jeopardize the group's tax-exempt status, and the proceeds are not taxable. The organization may use this income for its own operating expenses (including salaries for officers and staff) or for the benefit of the local library. What it cannot do is distribute any of the income to the nonprofit's officers, directors, or others connected with Friends of the Library.
Sometimes nonprofits make money in ways that aren't related to their nonprofit purposes. While nonprofits can usually earn unrelated business income ("UBI") without jeopardizing their nonprofit status, they have to pay corporate income taxes on it, under both state and federal corporate tax rules. (Generally, the first $1,000 of unrelated income is not taxed, but the remainder is.)
Let's go back to the Friends of the Library nonprofit corporation for an example of unrelated income. People donate thousands of books to Friends of the Library for an annual book sale, one of its major fundraising events. Although the sale is always successful, let's say that one year, thousands of books are left over. The group decides to sell the more valuable of these books by advertising in sources for rare and out-of-print books. The response is overwhelming. Before long, the Friends of the Library has six employees cataloging books for sale. Soon, Friends of the Library finds itself in the business of buying books from other dealers and reselling them to the public. They will have to report these earnings to the IRS, which will tax them as income from unrelated business activities.
Why? In some situations, excessive unrelated business activities can also prompt the IRS to reconsider a nonprofit's 501(c)(3) tax-exempt status. To avoid this, a nonprofit should never let its unrelated business activities reach the point where it starts to look like a regular commercial business. For instance, unrelated business activities shouldn't absorb a substantial amount of staff time, require additional paid staff or volunteers, or produce much more income than that generated by the organization's exempt activities.
Because the difference between "related" and "unrelated" activities can be confusing, the IRS has said that some nonprofit sales activities will not be taxed, even if they aren't related to the nonprofit's purpose. Here's a quick rundown of the activities that aren't taxed:
To learn more about the rules that your nonprofit must follow to maintain your tax-exempt status and avoid problems with the IRS, see Every Nonprofit's Tax Guide: How to Keep Your Tax-Exempt Status & Avoid IRS Problems, by Stephen Fishman (Nolo).