"selling condos" isn't working illegally. You do not need a visa/work permit to invest in real estate or the Thai stock market, or bonds for that matter.
No, it doesn't "depend". Foreigners are prohibited from working in retail. They are NOT prohibited from working in management positions in hotels, restaurants, and other businesses. If you have a work permit like you're supposed to, you can in fact, do work.