In inelastic collisions, the kinetic energy of the system is not conserved however momentum is still conserved. How is this possible?
Think of them compressing a mutual one-way sticky spring (that only compresses and doesn't expand).
Let's say total momentum $L = m_1 v_1 + m_2 v_2$ where $v_1$ and $v_2$ are opposite in sign and the two masses are approaching one another.
Then, after the inelastic collision, the "new" (combined) object will have mass $M = m_1 + m_2$ and velocity $v$ = $L/M$. The new kinetic energy of this mass will be therefore be $$E_2 = \frac{L^2}{2M} < E_1 = \frac{m_1v_1^2}{2} + \frac{m_2v_2^2}{2}$$ with the difference $E_1 - E_2$ stored as elastic potential energy inside the spring.
So, all the pre-collision energy is still conserved (partly as kinetic energy and partly as spring elastic potential energy).