This is a saying that, while obviously true in its literal sense — the Captain does have a nicer room than the yeoman — is used to indicate the speaker's resigned dismay at his superior's extra-official benefits. It is particularly appropriate when the higher-up gets away with unseemly/non-regulation/illegal behavior that other people would not.
Officially, the Captain has the nicest room. Unofficially, you get to carry his bag if you happen to be loitering at the foot of the gangplank when he's ready to come aboard.
Of course, RHIP is not restricted to military situations.
Officially, the President of the United States has his own limousine to drive him around. Unofficially, you'd better get out of the street and relinquish your parking spot to him.
And, it's true in the private sector as well.
"How many times have I told you not to drink from the milk carton?"
"But you do it all the time!"
"I'm the mommy. Now go to your room."