Yes inverted eyelids can be genetic. If you think it might be the ram, don't keep any of his sons or daughters for breeding.
Before resorting to antibiotics, pinch the eyelid to bring the lashes back to where they should be. Sometimes that's enough, or you may need to do it a few times before it settles. If it isn't staying put, you can slightly bruise the eyelid as you do it, which makes it swell slightly, and sometimes that is enough. (Sounds brutal but it's a lot kinder than letting the eyelashes scratch the cornea.)
If you cannot make it stay, then the antibiotics should be injected into the inside of the lower lid with a very, very fine, tiny needle. The injection makes the lid slightly bulbous, which helps to keep the lashes outward. I used to take the lambs to the vet to do it as it was rare for us that pinching didn't work, but the vet was happy to dispense needles and antibiotics for us to do it ourselves if we wanted.
Any tendency to inverted eyelids will be exacerbated by any dehydration. So make sure that any such lambs are feeding well, and be prepared to top them up if not.
In my experience, this problem is particularly prevalent in Texel sheep. From posts on this forum, it may also be an issue in Ryelands. Personally, I have never had this problem with any Shetlands or Manx sheep.