Because your mouse is the screen position while your ray origin is the world position. The fact that y is the same is just a coincidence that your camera happen to be positioned properly for this.
Your ray position is depending on the position of the camera in the world, the Input.mousePosition is always a value between 0 and width/height of the screen.
↧