One of the corollaries of Stalin's decision to build socialism in one country was an increasing isolation of the Soviet Union. Many countries were indeed hostile to the Soviet Union, and ideology cast the situation as "capitalist encirclement" -- every country, every foreigner was potentially an enemy. Russians were not allowed to travel abroad, and very few foreigners were granted permission to enter the Soviet Union. Those who did were watched very carefully.
Foreigners required special documents and had to be registered wherever they lived. There were certain areas they were not allowed to enter. For example, if one had a visa and permission to live in Moscow, one could not stray farther than 20 km from the center of the city without permission from the authorities. A special arm of the NKVD was assigned the task of observing foreigners in Russia.
Special hotels were designated for foreign visitors. Among these were the Metropole in Moscow and the Astoria in Leningrad, which are named in Master and Margarita. Such hotels became almost as impossible to visit for the average Soviet citizen as actual foreign countries. Without the appropriate documents, no one was allowed in.
The closed economy provided another barrier between Russians and foreigners. From 1928 the import and export of Soviet currency was prohibited. At the same time possession of foreign convertible currency and gold was highly regulated. After NEP there were campaigns to have precious metals and convertible currency given to the state.
The exchange rate could be set artificially by the state, since there was no free market that could deal legally in rubles. Only rubles were accepted in Soviet markets and no rubles could be exported to be traded on open Western markets.
One tactic the state used to control precious metals and foreign currency was the institution of special stores in which payment could be made only in these instruments. Rare goods unavailable in other stores were stocked in such stores to attract potential customers: foreigners or elite Russians who might have legal access to convertible currency.
In the 1920s one such store was the Torgsin (Trade with Foreigners), which appears in the novel. In the later years they were renamed Beriozka (Birch Tree), of which branches were found in or near most hotels for foreigners. Into the 80s they had goods not available in Soviet stores and allowed purchases only in foreign currency or special "diplomatic coupons."
A view of the Torgsin store in the 1920s