Your (and many other people's) understanding of "non-profit" is incorrect. How do you think small organizations grow into multinational and worldwide organizations that dwarf for-profit businesses? By making a profit. Non-profits should be making a profit for financial stability and growth. However, there are limits. Laws and regulations will vary by locality and country.
Do some research, but this is a good place to learn a little about it: Myths About Nonprofits
As for the tech side, .org was initially thought of being used for non-profits. However, there is no law or rule in a Terms of Service stating this. Certainly no one was checking whether or not an organization was or was not for-profit. Just like there is no rule requiring a .com address be used for commercial purposes. As the internet took off, the demand for domain names skyrocketed and the initial plan for Top Level Domains was quickly abandoned and even more were added. Why? For profit!