This is because the origin of the cube is in the middle of the mesh. Therefore placing the cube at the plane will show the cube halfway under the plane. There are several ways to handle this situation.
One option is:
Parent the cube to an empty that the cube is on top of the empty.
Move the empty rather than the cube
mouseOverSensor.hitPosition helps you to find a position on the plane.
After getting the position on the plane (see above), you can “correct” the position to fit your grid.
An often used method is to round to the next grid coordinate. e.g.