Even generic products can have different packaging. For example, something as simple as aspirin can be manufactured by many different firms, none of whom seek to call it anything other than 'aspirin'. Even so, people might be more likely to pick up the version which comes in smart packaging. (Of course, some firms seek to add their own brand name, such as 'Anadin', and vastly inflate their prices but that doesn't mean that firms who simply use the name 'aspirin' won't consider spending money on packaging)..
Some non-generic products do have genuine advantages over generic versions. For example, even though they might contain exactly the same amount of exactly the same drug as the generic version, the tablets might be easier to swallow. (For some patients, with certain conditions, that might be an important consideration).
Similarly, some tablets are designed to dissolve quickly (so that the drug 'gets to work' as soon as possible) whereas other tablets or capsules are designed to dissolve slowly (so that the drug is released slowly and works over a longer period). It's for reasons like this that the BMA supports the right of doctors to prescribe non-generic versions of drugs.
Pharmacists are normally obliged to dispense exactly what it says on the prescription but I understand that they are allowed a certain amount of discretion if the specified version is out of stock. (Some of this discretion seems to come from formal agreements but much of it seems to be simply that a doctor will say to a pharmacist ,'You really don't need to keep phoning me up to check that it's OK to swap these two versions of the drug over. Just go ahead and do it'). It should be remembered that, as far as drugs are concerned, a pharmacist is vastly more knowledgeable and better qualified than any GP, so it's perfectly reasonable that they should be allowed a certain amount of discretion.
Chris