How to prevent the objects from going through the floor?
The first thing I see, is that you are loading both objects at the exact same point, "Empty". If it's the default cube and plane primitives, then you're spawning your cube halfway below the plane. Then your changing the vertices of the object, not the global position. This is basically saying "render the object at one location, but render the mesh at another.

This image shows, the collision box offset from the mesh renderer, because the vertex positions where modified, not object position:



So, chances are, your collider is still halfway through the plane, while the mesh is offset the distance you specify. 

If you remove the part of your script that moves verts, and just adjust the global position, the box will rest on the plane. 

Is there a reason your moving just the mesh(verts) and not the entire object? 

If you need help seeing what's going on, you can turn on 'Collision Bounds' in the 'Physics Tab' of 'Properties Panel' for both the Cube and Plane. Also, enable 'Physics Visualization' in the 'Render Tab'.