There are different rules for collecting taxes for non-resident aliens and for residents.
It is necessary to establish the difference between resident non-citizens and non-resident non-citizens. The former are Green Card holders, and have been in the United States for at least 183 days in a three-year period, and also have permission to legally live and work in the country.
Non-residents, on the other hand, are people who live outside the United States, but earn from an income source in the country. In addition, their stay in the country is legal but not with a Green Card, but as tourists or another type of visa.
Both categories must pay certain taxes. Non-residents only pay taxes on the income they earn in the United States. For example, a foreign investment in the United States usually represents taxes of 30%.
On the other hand, residents must pay taxes on any form of income regardless of its foreign or domestic origin, or even money received through pensions in other countries.
There are methods, such as the foreign earned income exclusion or the foreign tax credit, that can help residents avoid paying certain taxes on income received from abroad.
Likewise, residents who work for other governments within the United States, such as embassies, consulates or others, can access the reduction of their taxes on their salaries.
In the case of Social Security Administration (SSA) benefits, the United States Internal Revenue Code withholds taxes from nonresident aliens who receive monthly benefits for retirement, disability, or survivorship. The tax is set at 30% of 85% of the benefit, that is, 25.5% of the total monthly benefit.
For these cases, the SSA has implemented a tool for calculating taxes on social security benefits: