Let R be each side of the base and H is the height. Take a slice of the pyramid of thickness dh and length r at a height h from the vertex.

The volume of this slice is

dV = r^2*dh.By simple geometry you can see that R/H = r/h.

Hence

r = (R/H)*h.

dV = (R/H)^2*h^2*dh.

To find the total volume find the integration between h = 0 to h = H.