To calculate gravitational potential inside a homogeneous sphere of mass m, it is essential to recognize that the gravitational force depends only on the mass closer to the center, as the forces from outer mass cancel out. The sphere's volume is (4/3)πR^3, leading to a density of (3/4)m/(πR^3). The mass below a radius r is given by m(r/R)^3, resulting in a force of -Gm(r/R)^3M/r^2, which simplifies to -Gmr/R^3. Consequently, the gravitational potential energy is expressed as -Gmr^2/(2R^3). This understanding is crucial for generalizing gravitational calculations in non-diametric tunnels through a sphere.