It's neither rocket science nor socially evil how Xiaomi and others sell such nice phones for less.
1. They're okay with not making record huge profit margins on the hardware like Apple does.
2. They don't have the overhead of Apple, who spends a ton on fancy HQs, tens of thousands of employees, stores, R&D on cars, ads, etc.
Consider that Apple pays Foxconn about $230 for an iPhone 7 that it sells for $650. Now imagine if they were instead willing and able to take only a 2% profit margin like Xiaomi.
Frankly, beyond greed, there's no reason for phones to cost very much. It's no different than the way that DVD players, microwave ovens and other consumer goods started at $1,000 but now can be had anywhere for far less.