A dispensary is generally within a hospital and dispenses medicines to patients upon being prescribed, while a pharmacy can be attached to of free of a hospital and dispenses medicine both upon prescription and you can get some drugs over the counter too for those which do not need to be prescribed. But these days both the terms have come to mean the same and can be used interchangeably.