I found this example sentence in "A Dictionary of Intermediate Japanese Grammar" under a grammar point unrelated to "とは限らない":
"運動をよくする人が必ずしも長生きするとは限らない。"
I understand the meaning of the sentence ("People who exercise a lot don't necessarily live a long time.") but I'm struggling to understand the logic behind this usage of "とは限らない". If this dictionary did not have an English translation I would think it meant "Living a long time is not just limited to people who exercise a lot" since "限る" means "to limit" in other contacts.
Without the "とは限らない", the sentence means "People who exercise definitely live a long time." From my understanding of "必ずしも", you can say "長生きしない" instead of "長生きする" and it should also have the meaning "People who exercise a lot don't necessarily live a long time".
So why is "とは限らない" used this way? And bonus question, what is the semantic difference between "運動をよくする人が必ずしも長生きするとは限らない" and "運動をよくする人が必ずしも長生きしない"?