In MAME, you have to apply a patch the source code and then compile it for hi scores to save. It is the same patch that removes the nag screen from the intro of each game. It can be found here. I have successfully applied this patch to the MESS source code (which is actually now combined with the MAME code in a single package as of build 0.147) in order to remove the nag screen. So hopefully you could apply the patch to get the hi scores to stick as well. It's worth a shot, even to remove that darn nag screen. Mr. Do has a guide on compiling MAME/MESS here. Headkaze also has a pretty neat utility to compile here.