This first started appearing in the 1930s, meaning just a man/chap. Perhaps the opening 'm' seemed to fit with the 'm' of mate and hence it came to be applied more frequently to a friend/acquaintance. The origin is unknown and it doesn't appear to have much connection with any of the other meanings of the word.