Plenty of foreigners invest in US businesses. They do NOT work in the US! They do not even come to US. There are people who start online businesses using a dot-com address, so it appears to be in US, but they work from their home country & do not enter US, never work in US.
IF you are in the US, you can only start & run a US business IF you are legally authorized to work in the US. You cannot obtain any employment visa. So you would have to be US citizen, legal permanent resident, or hold a currently valid visa of a type which allows you to apply for EAD & actually hold currently valid EAD. So if, say, you are on a student visa, that strictly prohibits working, and there is NO eligibility to apply for EAD. Starting to work online is a visa violation which gets your student visa revoked with mandatory departure & permanent bar to reentry for visa fraud.
Note this makes you subject to US tax laws, and US taxes ALL income from all sources worldwide. Getting stuck in the US Tax Trap may be a very severe negative for those with income abroad, as you have to report & pay US taxes on it.