To my knowledge:

1) Pharmacies don't sell cigarettes (In Australia anyway)

2) Setting the dispensary at the back makes people walk through the shop, potentially eying other products.

3) You'll often have to wait for 5-10 minutes to get your prescription.Having people crowd in the back is better than having them crowd the front shop, driving off potential customers.

4) As you said, most people who go to pharmacies are there to get medication. The vast majority of their turnover stock are medicines. Locating the dispensary at the back also eases stock holding and restocking.

5) What Assertn said