
The secret lies in the fact that the blocks are weighted as indicated by the dotted lines. Note that the slabs can fit in the box only one way. The cord, which is used to tie the cover in place, really acts as a pivot.
The magician can tell which slab is inside by the direction the box tips. Alternately, if using a thin string instead of a cord, the magician can pick up the box by the knot and see which way it tips.
This has been another magic trick you can build yourself, courtesy of the Great Mysto!