And it will be that if you listen to the voice of Hashem your God to observe, to perform all of Hashem’s commandments that I command you this day..."You should be blessed when you come and you should be blessed when you leave."
On the possuk (Devorim 28/6), "You should be blessed when you come and you should be blessed when you leave." the Medrash explains, "You should be blessed when you come with your merchandise and you should be blessed when you go out with your merchandise. Dovid HaMelech explained, "Hashem will guard your leaving and your coming forever."
Zera Shimshon asks two questions. Firstly, what was the difficulty the Medrash has that the possuk "Hashem will guard your leaving etc." resolved? Secondly, in our possuk, Hashem first blesses you when you come and after that when you leave, while Dovid inverts the order, first mentioning Hashem guards you when you leave and after that when you will come.
Zera Shimshon answers that the opinion that this possuk is referring to merchandise is not the only way to explain this possuk. The Medrash also gives another explanation; "You will be blessed when you come into this world" i.e., when you are born, and "you should be blessed when you leave" i.e., when one passes away.
Seemingly, this explanation is more precise than the first explanation since a person is first born- "You should be blessed when you come"- and after that he dies- "you should be blessed when you leave". According to the first explanation, however, the possuk seems to be backward; “You will be blessed when you come”, i.e. when you come back from buying goods; meaning, people will buy at a high price, and “You will be blessed when you leave”, i.e. leave to go buy merchandise; meaning you will be able to buy at a low price? A person buys merchandise before he sells it! He can't sell something before he buys it! This is the difficulty that the Medrash was dealing with.
To validate this peshat, the Medrash quotes the possuk in Tehilim, "Hashem will guard your leaving and your coming forever" in which it is written that Hashem guards a person when he comes before he leaves. Obviously, this possuk cannot be speaking about being born and dying since one cannot die before previously being born therefore it must be referring to buying and selling merchandise.
It is written in the Gemara Taanis (9a) that there is nothing written in Kessuvim that is not alluded to in the Torah and therefore our possuk, which also speaks about coming and going, must be the source of the possuk in Tehillim. Therefore, since the possuk in Tehilim is referring to buying and selling merchandise so too our possuk is speaking about a berachah in merchandise just as the first explanation explains.
However, the question still remains, how did the Torah bless the person coming back from selling his wares before he went to buy them?
Zera Shimshon explains that the blessing of "you will be blessed when you leave" is not referring to a blessing you will have when you leave to buy your goods but it is referring to a merchant who leaves his house, his city or even his country to sell his goods, like a person who is a traveling salesman or a person whose store is not in his house. The blessing of "you will be blessed when you come" is referring to goods that he brings to his family that he bought with the money he received in exchange for what sold.
According to this, the possuk opens with the Bracha on what he brings back to his house before the Bracha on what he sells, even though this happens only after he sells his goods and receives money for them, because what he brings to his house is first in importance. The whole purpose of his going to work and selling goods is only to be able to buy goods for his house. The possuk is telling us that if a person listens to the voice of Hashem and performs Hashem’s mitzvos then Hashem will bless everything you will eventually buy in the future for your house already from the time that you receive money from selling your merchandise since you sold things only in order to earn the money to buy for your house!