The two bullets have the same initial momentum, directed upward. They have the same mass, and because they are fired from identically prepared cartridges from the same rifle, they have the same velocity before entering the block.
The two blocks both have the same mass and are both initially at rest before the collision.
Upon impact, conservation of momentum states the momentum of the bullet before impact will be equal to the momentum of the bullet–block system after impact. So both systems have the same upward momentum after impact. And because they have the same mass, they therefore have the same upward velocity after impact.
Because they have the same upward (center-of-mass) velocity after the collision, the two systems then travel to the same maximum height (by constant acceleration kinematics).
The two bullets have the same kinetic energy before the collision, because they have the same mass and speed. Conservation of energy states that both bullet–block systems have the same total energy after the collision.
However, the energy takes different forms after the collision in the two cases. They both do have the same translational kinetic energy after the collision (because they have the same momentum, mass, and center-of-mass speed). But in the first case, more energy has gone into deforming the block, and the bullet is embedded deeper. In the second case, less energy goes into deforming the block—the edge of the block "moves with" the bullet and the bullet does not get embedded as much. The remaining energy instead goes into the rotational kinetic energy of the system.