That has to be factored into the experimental design and the final calculation of course. If your book claimed that all the falling energy becomes heat then your book is in error - but I suspect they do not make such a claim.
The kinetic energy of the blocks is less than if there was no water... they fall slower.
The water also gains rotational kinetic energy, and there are issues with calorimetry.
All these can be taken into account in a careful setup. Joule worked out the mechanical energy deficit and demonstrated that this was consistent with the heat increase in the water. The experiment more easily disproves the, then accepted, calorimic theory of heat that treated heat as a substance in it's own right.