This is true. If you have the money, some people would sell you anything in the store. Problem is, that doesn't mean it isn't illegal there....and a prison in morocco is NOT where I would want to be for any amount of time.
Keep in mind that it's a muslim country that bases their legal system heavily on the Koran. While you might get lucky and find someone in the pharmacy who will accept your bribe, if a muslim sees the exchange happen they would be beyond happy to turn you both in as the Koran says they should.
In my opinion it definitely isn't worth the risk.