I've heard that its for balance.
Its also only in long straights that they do it. I guess it could help the turning of the bike by bringing your leg off the peg you through off the center of gravity and it helps pull the bike into the turn tighter...at least that is what i can gather from what I know about physics...which isn't much