You can easily bury them up to the cotyledons without harm, and perhaps further (I buried a few up to the second node last year specifically because they were a bit leggy). You should keep them a bit on the drier side the more you bury them, as moist soil is what promotes stem rot, and if you bury them straight down the bottom of the pot will be moister than the top anyway. It may take a few weeks for new roots to grow off the stem, depending on the age of the seedling. You can also carefully plant it horizontally so the roots are closer to the surface and the stem is near or at the surface of the soil, and roots will still form along the stem. Again, you always run the risk of stem rot/disease depending on the growing conditions.
This still wouldn't solve your leggy issue unless you get them more light though... the new growth will continue to stretch so long lighting is insufficient.