When a person permanently works outside their country of origin, that person may be relieved of double-taxation if his country of origin and the United States entered into tax treaties, known as totalization agreements.
The same problem of double taxation and a lack of benefits can also occur with U.S. citizens or permanent residents working abroad. Totalization agreements seek to remedy this problem of double taxation, as well as to fill in gaps in multiple country's old-age benefit programs. In addition, these nationals may also be subject to their home country's pension taxes, resulting in double taxation on the same income. The agreements are made between the U.S. and other individual countries, and govern international taxpayers who earn money in the U.S. Totalization agreements are international tax treaties that seek to eliminate dual taxation with regards to Social Security and Medicare taxes in the United States. The goal of totalization agreements is to eliminate dual taxation on a foreigner's income made in the U.S. as well as provide proportional Social Security benefits for the same foreign workers. 
