Ive driven to maroc twice, the last time in 2003 so things may be different. the first year we had no insurance for Maroc, we had been told we wouldnt be let in withoutit, and that we would have to buy at the border, however after a few hours crossing and paperwork going backwards and forwards with cash to differnet people we had nothing. Thankfully we were fine.
The second year we did have to get some to get in, however if your short of cash you can simply buy enough to get yourself in, and take the gamble that youll be parked at the beach the majority of time and only be driving down to Essaouria etc at the start and end..but its a gamble clearly. We got enough for most of the trip, and then more before we started driving north to leave.
Cant remember costs but it wasnt stupid expensive and always good to have.
Having said that some friends effectively wrote their car off (in a head on) in the mountains 2 days after their insurance ran out..despite lots of police involvement there was never any problems, and they simply paid out to get the car on the road again..but you never know!