Looking on the World Wide Words website, it looks like it started as an insult for people who were being too smarmy and affectionate in public. In other words, too much PDA (PDA means Public Displays of Affection). Here is the article: http://www.worldwidewords.org/weirdwords/ww-lol1.htm
Lolly gag, lollygag, lolligag, lallygag, etc., all derive from American English (1862); lolly "tongue", and "gag" to decieve, trick. :
In the sense "dawdle, dally," 1862, lallygag, American English, perhaps from (carnival dialectic) lolly as "tongue" + gag as "deceive, trick" from the hawkings of barkers for custom.
Please do not lolly gag in the hallway.
The word "gag" is a palindrome for the word joke.
gag
come gag
Although he made a good gag, nobody even smiled.
The DVD did not have enough space to hold the gag reel.
gag
gag
gag
Soap
Gag
There is a list of gag gifts on word press - the link to which can be found in related links.