Thank you for your question.
International students on F, J, M, O, visas do not pay social security taxes or Medicare taxes on their income as long as they have accumulated less than 5 years of physical presence in the U.S. during thier life time.
the 183 day rule for being treated as a resident does not apply as long as you do not intend to stay or do not stay longer than 1 year. So in this situation you would be exempt form taxes on capital gains unless you were to be here 1 year or more, and be taxed as a non-resident otherwise. AND again, as long as you have not accumulated 5 years, you do not have to pay SS and MC taxes.
However, you will still have to pay state and federal taxes for employment income and for income affectively connected with u.s. sources or business activities.
So if you are working on line, whether or not it is legal to do so, you are required to pay taxes.
Besides the tax you also ask if it is legal to work in the U.S. on line. AND I must tell you, that the immigration laws, technically prohit you from working while in student status unless it is part of one of the four following sitautions:
1. On campus work for the university.
2. Curriculum training program designated on your form I-20.
3. Optional pratical training (OPT) for up to one year (you have a work permit card,m and it is designated on your form I-20)
4. Hardship, also designated on form I-20 and you would have a work permit card.
According to the IRS, you are allowed to invest in a business, ran by others, and you can even be a part owner in an LLC (partner ship or sole proprietorship), but accordign to the USCIS, you can not work for that entity. (inactive owner). As an inactive owner you coudl share in the profits, but again, you are not legally allowed to do work under the immigration laws.
NOTE: The IRS would still require the reporting of income and paying of taxes; but the IRS by law is not permited to report this to the USCIS. So you are not in danger of being discovered by virtue of paying your taxes.