Immigration establishes that you are legally entitled to reside in that country for a period of time. Often customs and immigration are handled simultaneously, but occasionally you may be asked to go through immigration procedures separately. When you leave a country, you will go through customs and immigration again. Your visa will be canceled and you will declare what goods you have purchased while abroad. When you reenter the US, you will go through US customs at your port of entry.
Purchases exceeding that amount are subject to duty taxes.
If you plan to buy a lot of items while abroad, you should retain all of your receipts as proof of what you paid.