I do not say that it is fully safe because there are past issues about ledger nano S where the sellers and retailers are able to get the fund of the users. That is why for those who want to buy ledger nano s make sure that you will buy at the legit sellers.
What you talk about applies to every hardware wallet which is being purchased from unauthorized sellers, or if it is a used device. The problem is not that such devices come with an already generated seed, but the fact that those who buy them do not reset the device and make new seed. This is a very simple attempt of fraud, that can easily be avoided.
I saw Ledger and Trezor compared and there were some small issues with how ledger is build. Trezor was found to be more secure because it's completely offline and there's no way hos your keys can be compromised. It's not that simple with ledger but it still offers a very high level of security.
You could also use a computer which can have its internet card disconnected. Any device that stores your kyeys offline is 100% secure.
Ledger and Trezor need to be connected to the internet to be able to send transactions, how would you use wallets like this if they were completely offline? But such devices are designed to never expose private keys, process of sign transaction is always inside hardware wallet.
Nothing is 100% safe, so neither devices that are offline - they are all subject to psychic attacks where an attacker can attempt to extract a private key or seed using some security vulnerability, which is for some time possible with Trezor models if users did not set very strong paraphrase.