1784, lolly-pops "soft candy, coarse sweetmeat made of treacle and sugar, usually with butter and flour added," a word "of obscure formation" [OED]. The elements are perhaps related to loll (v.) "to dangle" (the tongue) + pop "a strike, slap." Or the first element may be northern dialectal lolly "the tongue." Figurative sense of something sweet but unsubstantial is by 1849. Meaning "hard candy on a stick" is from 1920s.
Others are reading
<a href="https://www.etymonline.com/word/lolly">Etymology of lolly by etymonline</a>
Harper, D. (n.d.). Etymology of lolly. Online Etymology Dictionary. Retrieved $(datetime), from https://www.etymonline.com/word/lolly