Suppose I have a body of mass $M$ connected to a spring (which is connected to a vertical wall) with a stiffness coefficient of $k$ on some frictionless surface. The body oscillates from point $C$ to point $B$ and $CB=d$. Its motion is harmonic. The total energy of such a system is simply $\frac{1}{2} k \left(\frac{d}{2} \right)^2=\frac{1}{8} k d^2$ (because the equilibrium point is at $d/2$ and $d/2$ is the amplitude). Now, suppose we drop vertically some plasticine with the same mass $M$ from some height $h$. After it hits the oscillating object, it just sticks to it.
My question is - why the total energy of the system doesn't change if the plasticine hits the object at point $C$ but it changes when it hits the object in the middle of $CB$ (it equals there to $\frac{1}{16} k d^2$)? Intuitively, I do understand that such a plastic collision contributes to the loss of energy, but I'm not sure how exactly it fits here and how the energy is lost. And even so, I do not understand how the position of the body influences the change in energy.
Proposed solution:
The total mechanical energy at point $d/2$ is $E_{k,max}=P_{total}=\frac{1}{8} k d^2$:
$E_k=\frac{M}{2}V^2\\ V=\sqrt{\frac{2E_k}{M}}=\sqrt{\frac{2P_{total}}{M}} $
Due to the conservation of the horizontal momentum we get:
$MV=2MV'\\ \frac{2E_k}{M}=4V'^2\\ V'=\sqrt{\frac{E_k}{2M}}=\sqrt{\frac{\frac{1}{8}kd^2}{2M}}=\sqrt{\frac{kd^2}{16M}}$
Therefore, the momentary kinetic energy (which is the total energy) after the hit is:
$$E_{k, after}=\frac{2MV'^2}{2}=M \frac{kd^2}{16M}=\frac{kd^2}{16}$$