Read the statute like this:
Prior art is an invention that
-described in a printed publication
-in public use
-otherwise available to the public.
The courts have determined that offering an invention for sale - regardless of whether it's openly on sale to consumers or only sold in private contracts - constitutes prior art, because otherwise, an inventor could sell the invention privately for a long time, and only patent it (and get the full patent term) when the inventor fears that someone else is close to patenting the same thing.
In other words, construing "on sale" to mean only "public sales" would allow an inventor to benefit from patent law for longer than the patent term. You have a choice - you can protect your invention by patent law, or you can protect it by trade secret law. Not both.