Hi there! Thank you for the opportunity to help you with your question!
The term non-profit does not prohibit a company from having more revenue than expenses. It just means that, in case that revenue is greater than expenses, then that surplus will be reinvested into the company, instead of being paid out to directors etc. If a nonprofit organization does earn extra revenue, then the money should go to the organization itself, to the mission of the organization (for instance, a nonprofit organization for protection of the rainforest may reinvest additional revenue to plant new trees, research, and other operations that benefit the cause).
Please let me know if you need any clarification. Always glad to help!