I am looking for a formula for the volume $V_i(r,L)$ of the intersection between a sphere of radius $r$ and a cube of edge $L$ with the same center.
For $r<\frac L 2$, $V_i$ is simply equal to the volume of the sphere:
$$V_i(r,L) = \frac 4 3 \pi r^3 \ \ \ \ r<\frac L 2$$
For $r>\frac{\sqrt 3} 2 L $, it is equal to the volume of the cube:
$$V_i(r,L) = L^3 \ \ \ \ r>\frac {\sqrt 3} 2 L$$
For $\frac L 2 < r < \frac{\sqrt 2} 2 L$, it is equal to the volume of the sphere minus six times the volume of a spherical cap. The result is
$$V_i(r,L) = \frac 4 3 \pi r^3 -\frac \pi 4(2r-L)^2(4r+L) \ \ \ \ \frac L 2 < r < \frac{\sqrt 2} 2 L$$
However, for $\frac{\sqrt 2} 2 L < r < \frac{\sqrt 3} 2 L$ I have not been able to think of an easy way to calculate $V_i(r,L)$.
As John Hughes notes, you can fix the side of the cube or radius of the sphere and work in terms of the ratio. The strategy here is to fix the cube's edge length to be $2$, calculate the area of plane slices parallel to one face of the cube, then apply Cavalieri's theorem.
Theorem: The intersection of the square $[-1, 1]^{2}$ with the disk of radius $\rho$ centered at the origin has area $$ A(\rho) = \begin{cases} \pi \rho^{2} & 0 \leq \rho \leq 1, \\ \pi \rho^{2} - 4\rho^{2} \arccos(1/\rho) + 4\sqrt{\rho^{2} - 1} & 1 < \rho < \sqrt{2}, \\ 4 & \sqrt{2} \leq \rho. \end{cases} $$ The intersection of the cube $[-1, 1]^{3}$ with the ball of radius $r$ centered at the origin has volume $$ V(r) = \int_{-\min(1, r)}^{\min(1, r)} A(\sqrt{r^{2} - x^{2}})\, dx = 2\int_{0}^{\min(1, r)} A(\sqrt{r^{2} - x^{2}})\, dx. $$
Trivial Cases/Sanity Checks:
If $0 \leq r \leq 1$, then $0 \leq \sqrt{r^{2} - x^{2}} \leq 1$ for $|x| \leq r$, so $A(\sqrt{r^{2} - x^{2}}) = \pi(r^{2} - x^{2})$ and $V(r) = \frac{4}{3}\pi r^{3}$.
If $\sqrt{3} \leq r$, then $\sqrt{2} \leq \sqrt{r^{2} - x^{2}}$ for $|x| \leq 1$, so $A(\sqrt{r^{2} - x^{2}}) = 4$ and $V(r) = 8$.
Interesting Cases (edited to fix mishap with limits of integration):
If $1 < r \leq \sqrt{2}$ (dark gray), then
so the volume is \begin{align*} V(r) &= 2\int_{0}^{1} A(\sqrt{r^{2} - x^{2}})\, dx \\ &= 8\int_{0}^{\sqrt{r^{2} - 1}} \bigl[-(r^{2} - x^{2})\arccos\left(\frac{1}{\sqrt{r^{2} - x^{2}}}\right) + \sqrt{r^{2} - 1 - x^{2}}\bigr]\, dx \\ &\quad + 2\pi\int_{\sqrt{r^{2}-1}}^{1} (r^{2} - x^{2})\, dx. \end{align*} (The second integral evaluates to $\frac{2}{3}\pi\bigl[(3r^{2} - 1) - (2r^{2} + 1)\sqrt{r^{2} - 1}\bigr]$, of course. I haven't verified explicitly that $V(r)$ evaluates to $\frac{4}{3}\pi r^{3} - 2\pi(r - 1)^{2}(2r + 1)$; the integral is elementary, but integrating by parts and making the obvious trig substitution gives a rational function of sine that looks tedious to integrate.)
If $\sqrt{2} < r < \sqrt{3}$ (light gray), then
so the volume is \begin{align*} V(r) &= 8\sqrt{r^{2} - 2} \\ &\quad+ 8\int_{\sqrt{r^{2}-2}}^{1} \bigl[-(r^{2} - x^{2})\arccos\left(\frac{1}{\sqrt{r^{2} - x^{2}}}\right) + \sqrt{r^{2} - 1 - x^{2}}\bigr]\, dx. \end{align*} Again, this integral is elementary, and can be evaluated exactly (in principle).