What exactly does "I'm sorry for your loss" mean?
The word sorry doesn't always mean "apologize."
Dictionary.com gives one definition as:
feeling regret, compunction, sympathy, pity,
"Sorry for your loss" means "I feel sympathy for your loss."
My heart feels sore for you. My heart is sore-ry. I am sorry.
sor·ry (sr, sôr)
adj. sor·ri·er, sor·ri·est
1. Feeling or expressing sympathy, pity, or regret: I'm sorry I'm late.
2. Worthless or inferior; paltry: a sorry excuse.
3. Causing sorrow, grief, or misfortune; grievous: a sorry development.
[Middle English sori, from Old English srig, sad, from sr, sore.]