Yes, a foreigner can invest in businesses almost anywhere in the world - Thailand included.
The important thing is the agreement you have with the local business and that's a one-on-one thing that you negotiate with the owners of that business.
Its a good idea to invest in business that you have some knowledge or experience of, instead of a business where your'e a total newbie.
Live your best life in Thailand. Get help with Visas, accomodation, itineraties, retirement, dating and anything else in Thailand.