Solution (source code)

= Solution

Take a face on the flat base and let $x,y$ be its positive half-widths, with height $z>0$. The upper vertices meet the spherical boundary at $x^2+y^2+z^2=a^2$, and the <rectangular parallelepiped> has <volume> $V=4xyz$. A <Lagrange multiplier> gives
$$
4yz=2\lambda x,\qquad4xz=2\lambda y,\qquad4xy=2\lambda z.
$$
Multiplication by $x,y,z$ respectively shows $x^2=y^2=z^2$. Positivity and the constraint give $x=y=z=a/\sqrt3$. Therefore
$$
\boxed{V_{\max}=\frac{4a^3}{3\sqrt3},\qquad
\text{edge lengths }\frac{2a}{\sqrt3},\ \frac{2a}{\sqrt3},\ \frac a{\sqrt3}.}
$$
Boundary choices with a zero dimension give zero <volume>, so this is the maximum in this configuration.

The <maximum-volume cuboid in a hemisphere> also has a bound covering arbitrary orientations. Let $u_i$ be any box's half-edge lengths, $v_i$ its <centre> coordinates in its orthonormal edge <basis>, and $n_i$ the vertical unit-vector coordinates. Remaining above the base <plane> requires $\sum n_iv_i\geq\sum|n_i|u_i$, so $|v_j|\geq u_j$ for at least one index. Its farthest vertex obeys
$$
a^2\geq R_{\max}^2=\sum u_i^2+\sum v_i^2+2\sum u_i|v_i|
\geq\sum_{i\ne j}u_i^2+4u_j^2,
$$
where containment supplies the first inequality. The <arithmetic-geometric mean inequality> applied to the three terms $u_i^2$ for $i\ne j$ and $4u_j^2$ yields $2u_1u_2u_3\leq a^3/(3\sqrt3)$. Thus its full <volume> $8u_1u_2u_3$ cannot exceed the value attained above; tilting cannot improve it. Boundary contact is allowed for the maximum; strict containment would give the same supremum.