Sam has two figures, one square pyramid and one rectangular prism. The pyramid has a height of 6 inches and a base length of 4 inches. The rectangular prism has a length of 8 inches, a width of 2 inches, and a height of h inches. If both figures have the same volume, what is the height of the rectangular prism?