iOS & macOS Are Not Open-Source Software Unlike Android

Apple Is Positioned as a Luxury Brand

Premium Apple Stores Are Costly To Maintain

Apple Uses High-Quality Components In Its Devices

Research And Development is Highly Prioritized

It Has A Strong Dominance of Apple Ecosystem

Marketing Costs

Cost of Fighting Legal Battles

Labor Costs & Salaries of Employees

Custom Duties & Taxes

And Finally Profits :)