There's two types of accredited drinking water in Morocco, town water and water from a well or spring source that has a filter fitted. As you ride along you might see some light blue 'pipeline covers' at the side of the road. This is the town water pipeline distribution system. Morocco has some 100,000 people working in its water industry and exports its know-how to other countries in Africa. The point is, town water is safe.
But if you are the sort of person who lives in Nottingham and gets the squits from drinking Sheffield tap water, this might not help much. Being bikers of course you may not remember the last time you drank water without hops.
Coffee is a diuretic, so when you order a coffee in Morocco (ask for 'nus nus') you will invariably also be given either a glass or bottle of water. The bottle will be town water that's been stored in the fridge, and this is where earthmover's comment about Timolgra sending back 'opened' bottles might have come from. They were likely free bottles of refilled and chilled town water that you don't get charged for...
Forget about avoiding salads (rarely washed anyway), forget about cleaning your teeth with bottled water. Town water varies across the country, in some places it has a faint smell of chlorine, which is another reason for sticking a bottle in the fridge and letting the chlorine dissipate. Mostly though it's fine and the sweetest water I have ever tasted anywhere is from Taroudannt.
Bottled water can be fairly dangerous. Sidi Harazem has so many minerals in it, its main use should be to clean dentures. Coca Cola's Ciel is tap water (!) with added chlorine—so much chlorine it made my son-in-law ill. Sidi Ali is OK, so is Ain Ifrane.
I tend to eat where the locals eat. After all if their local restaurant gave them the shits every day, they wouldn't be going there. But most importantly, as your mother always told you... WASH YOUR HANDS before eating anything. This is especially true when eating the delicious Moroccan bread, the 20 dh note you handled five minutes earlier might have been carrying all sorts of nasties. EVERY eating establishment from the lowliest cafe upwards will have a wash hand basin in the corner. Use it.
Twenty years ago I was one of a party of 16 on a fortnight trekking with mules adventure in Morocco. I was the only one who didn't end up 'praying to the china god from both ends' and I had to make up bulk supplies of rehydration sugar/salt liquid to treat my ungrateful fellow trekkers.
And talking about hydration, when you arrive at some hotels you may be greeted with awfully sweet mint tea and a bowl of the delicious dry roasted salted peanuts. This is deliberate as the sugar and salt are the essential components of rehydration solution.
If after all this you still get the runs, try to avoid using imodium and the like, as it's akin to sticking a cork up your bum. Let nature play its part in ejecting what it identifies as poison in your gut, drink loads of liquid and only use imodium if you really have to travel.
I'm reminded of a hilarious bit out of Charley and Ewan's first adventure when the visit the Aladdin's cave of Touratech in Germany and come away with a waterproof toilet roll bag. Top tip: take wet wipes instead which can be used for an additional variety of uses.