As the ball is released, it has maximum kinetic energy and no potential energy. This kinetic energy is converted to potential energy as the ball travels upwards, and at the top of its path, there is no kinetic energy, only potential energy. As the ball starts falling again, this potential energy is converted to kinetic energy.
The mechanical energy is the sum of kinetic and potential energies and it remains constant.