The reason they 'lose money' is real estate
If they account for a portion of their overhead in the "cost", like any business would, that will add up pretty quickly since Apple stores - where most of these repairs are carried out - are some of the most expensive real estate in the world.
One of the reasons the little kiosk in the "bad mall people usually avoid" can charge so much less is because they pay about 0.01% of the cost Apple does for their presence. They likely pay their employees less too; even if the hourly rate was the same they probably don't get health care like the Apple Store employees do.
Even if the cost of the parts were the same, those ultra expensive glass palaces are going to account for a majority of the disparity in repair prices.