Hi Siyu,
The HGT_M value from geogrid comes from the static topographic data. The met_em* files contain both that HGT_M value, which is identical to the value from geogrid, and SOILHGT, which is the terrain information coming from the input/first-guess data (e.g., GFS). During real.exe, both are used again. The HGT value in the wrfinput* files comes from the HGT_M value and should still be the same at that time (if using the default namelist setting surface_input_source=3). real.exe also checks for SOILHGT, which is used for smoothing the coarse grid topography on domain 1 during the wrf process.