There are such things as defensive publications, which prevents others from patenting something by providing a publicized proof of prior art.
But most companies would rather just patent something.
But most companies would rather just patent something.