Considering how cheap it is to manufacture a phone, it's possible they are manufacturing them for $40 or less each, and then expecting to make up much more than that with ad sponsoring and the usual Amazon services, app store, and marketplace.
Cell phone components are cheap now, especially at the low end. Amazon doesn't need to have a profit margin on the hardware. Same reason Google made Chromecasts for so cheap, though they might have made a little profit on those. Amazon has pay services that can reap profit directly while some of Google's tactics are more roundabout or indirect, so giving away phones isn't out of the realm of possibility. I'd bet Amazon was waiting a while for the hardware to get to this level.
I have 2 $80 phones in my possession, the Nokia Lumia 521 and the ZTE Open, both off-contract (and stock unlocked, in the case of the Open). I'm sure Nokia and ZTE made some profit directly from those phones, so I would bet Amazon could make a half-decent phone at $50 each and give them away. There will have to be some conditions, of course, to keep people from just harvesting the hardware or reselling them. Probably tied to an Amazon Prime account or a "verified" account and limited to one per account or something.