Was Amazon running at a loss at the gross margin level or the profit level?
Losing money at the profit level is fine, since that includes things like buying warehouses or developing technology.
Losing money at the gross margin level means you aren't even being paid for the goods you ship out, let alone the money you spend in infrastructure.