The car manufacturers do this because they want to detect misuses of the engine. If the car has a manual transmission and somebody downshifts at high speed to overrev the engine, it will be recorded into the car computer's memory and thus if the engine suffers damage, the dealership can determine that the reason for the damage was overrevving. Thus, the warranty doesn't cover this failure.
Now, how is it actually done? One possibility is that the maximum RPM the engine has attained is stored no matter whatever RPM it is. Another possibility is that it is only stored if the maximum RPM exceeds the redline. This probably varies from manufacturer to manufacturer.
If one dealer said that they can determine the maximum RPM, chances are your engine implements it in the former way, i.e. storing the actual maximum RPM even if it doesn't exceed the redline.