Morays are actually very gentle creatures. As long as you don't freak out and whip your hand away from them when trying to pat them, they are fine. At one of my local dive sites, they are used to being handled and they are huge! Some would be thicker than your arms and almost as thick as your leg!
They will sniff your hand, realise it's not food, then let you give them a tickle inder the neck. I've had one come right out into the open water with me, then decide my bcd was a good place to retire to
. I had to remove it completely to get him out.
The buggers I hate down there are the numb rays who are all but invisible under the sand. They hit you with a 200 volt electric shock if you accidentally touch them. Being a photographer on many dives, I often lean my elbow on the sand to get a close up shot. I've copped a few nasty shocks that way!