Since in the end, the king, Cheoljong (male), was feeling that something important was missing, and that was Jang Bong-Hwan (male), returned to the future. The king also asks the real So-Yong (female) why she was formal around him? This means the king loved Jang Bong's version of So-yong.
I know that it is not a BL drama that is why I stated as emotionally because Jang Bong-Hwan knows his gender when he is in So-Yong's body, and Cheoljing (even if he doesn't know Jang Bong-hwan) fell in love with So-Yong during Jang Bong occupated her body.