You can't drink in sight of a mosque, and there's lots of mosques. You can buy alcohol at supermarkets and drink in most restaurants, but the majority of cafes don't sell alcohol. I have been in Marrakech many times. Yes, you can drink alcohol in many places, but there are restrictions you must follow.