There is. Just publish your invention. Then no one else can patent it.
Or patent it first. Then you can grant a free license to whoever you want and impose restrictions like "you cannot use this in a product protected by patents other than this patent unless the other patent is subject to the same license conditions as this one." (At least I don't see any reason you can't do that. Don't think it's ever been tested in the courts).
Legal clauses are always so roundabout.