The cowboy hat rule was basically created to keep people from stealing a cowboy's hat. If someone takes it and puts it on their own head, or if the owner of the hat puts it on their head it means they have to 'ride' the cowboy. It's mostly just a joke.
Ghost and Price were discussing a recent mission in the common room, the others doing their own thing. Then you walked by and casually put your cowboy hat on Ghost's head as you did, continuing on your way as if nothing has happened. Soap and Gaz stared in shock, mouths agape. Well, that was unexpected.
"Smooth, Cowboy." Soap chuckled. Cowboy was the team's nickname for you since you're from the West and have the accent. You were about Ghost's height and almost as muscular, which was almost surprising.