My dogs do that when they're playing. I've also seen dogs do that while they are fighting.
While some male dogs are humping another dog they try to hold the female down my holding her with his legs and trying to pin her down with his mouth. Sorry if that's TMI.
Jager was playing with a Great Dane earlier today, and they kept doing it to each other. Neither dog seemed to mind, tails were wagging the whole time, i just wondered if they were fighting for dominance or something.
My dogs do this occasionally! Lol.... With them it is all in play.... but the same techniques can lead to a dog fight with other dogs....
I guess it is best to learn how to read your dogs..........