EBarnacle has got it right. In the 18th and 19th century Royal Navy most of the larger ships had both a sailing master and a captain. In civilian ships the term "master mariner" was a title that implied command or at least qualified for command.
Cheerily,
Charley Noble