Solution (source code)

= Solution

The base lies in the plane $z=R-h$. Its circular rim lies on the <sphere>, so
$$
r^2+(R-h)^2=R^2,\qquad 0\leq h\leq2R.
$$
Maximize the <cone> volume $V_c=\pi r^2h/3$ using the <Lagrange multiplier> expression
$$
\mathcal L=\frac\pi3r^2h-\lambda\bigl[r^2+(R-h)^2-R^2\bigr].
$$
For a nondegenerate <cone>, the $r$ equation gives $\lambda=\pi h/3$. The $h$ equation is $\pi r^2/3+2\lambda(R-h)=0$, hence $r^2=2h(h-R)$. Combining this with $r^2=2Rh-h^2$ gives
$$
\boxed{h=\frac{4R}{3},\qquad r=\frac{2\sqrt2}{3}R}.
$$
Indeed, eliminating $r$ gives $V_c(h)=\pi h^2(2R-h)/3$, which vanishes at the endpoints and has a unique positive interior maximum at $4R/3$. Thus
$$
\boxed{V_{c,\max}=\frac{32\pi R^3}{81},\qquad
\frac{V_{c,\max}}{(4/3)\pi R^3}=\frac8{27}}.
$$