The continuous displacive phase transition in SrTiO$_3$ near $𝑇_c\approx105,\rm{K}$ features a central elastic peak in neutron scattering investigations at temperatures above $𝑇_c$, i.e., before the corresponding soft phonon mode is overdamped upon cooling. The origin of this central peak is still not understood. Here, we report an inelastic x-ray scattering investigation of the cubic-to-tetragonal phase transition in SrTiO$_3$. We compare quantitatively measurements of the soft phonon mode on two differently grown samples and discuss the findings regarding results from thermodynamic probes such as specific heat and thermal conductivity. Furthermore, we use inelastic x-ray scattering to perform elastic scans with both high momentum- and milli-electronvolt energy-resolution and, thus, be able to separate elastic intensities of the central peak from low-energy quasielastic phonon scattering. Our results indicate that the evolution of the soft mode is similar in both samples though the intensities of the central peak differ by a factor of four. Measurements revealing anisotropic correlation lengths on cooling towards $T_c$, indicate that local properties of the crystals to which collective lattice excitations are insensitive are likely at the origin of the central elastic line in SrTiO$_3$.