Nonprofits can be in any industry. There are a lot of revenue funded nonprofits (as apposed to donor/grant funded). How you make your money is not really the metric by which an entity is called a nonprofit.
If we take a step back and look at for-profit corporations there is the need for. What this means is that the board, directors, & managers have a legal obligation to pursue profits for their stakeholders. If they fail to do this they can be sued, ousted, and replaced by someone who will. There are attempts to create singular exceptions to this with ‘Public Benefit Corporations’ (the term changes by location). This would allow a company to draft into their charter/by-laws a public good that they legally can place above profits.
Nonprofit entities do not have the fiduciary obligation to pursue profits. At the core that is the major difference. In order to register as a nonprofit countries have requirements that you must meet. Generally your entity must provide something for the public good. Some medical services, health insurance providers, transportation, food services, and more are revenue funded nonprofits. You also see a number of nonprofits in the technology & software space.
Personally I’ve founded and run 2 for-profit companies. My current company –– sells subscriptions to our nonprofit membership software. Most of our customers would be more traditional donor funded organizations, but it’s given me insights into that world beyond my volunteering and working for nonprofits in the past.