Yes, this is exactly what the US do for their citizens. It depends on whether the country of residence has a tax treaty with US.
If there is such, say Canada, tax paid in Canada is a tax credit in US. i.e. say C = tax in Canada, U = tax in US, one should pay C to Canada, (U-C) to USA if greater...