In France, shops and especially small shops are semi-private spaces. You have to behave as you would at an open house party. Everyone's invited, you are welcome to move about the place as you wish, but you have to pay your respects to the host or hostess. Therefore greeting the host or hostess on the way in and on the way out is customary.
Interestingly, this is reflected in the French language:
"je vais chez Roger" means "I am going to Roger's home". In French you don't usually say "I am going to the butcher shop", you say "je vais chez le boucher", i.e. it almost sounds like a social call as if your were visiting the butcher's home and not his place of business.
42 y/o, married, retirement portfolio = 43 x annual expenses