When we hardfreeze an element, and even use a set default value. Still an user can add a hidden element with the same name and submit the value. In this case the default value should be used not the submitted value.
The funtion that returns the value to mform is $element->getvalue ,which simply returns the data associated with the value attribute.
That is we are updating the value attribute of the element if data is submited, which should not be done incase the element is hardfrozen
Rajesh will be commenting with further details.