If they see a project that seems "interesting" (ie, has a potentially to be successful and have a very high AWS spend in the future), they're willing to subsidize[0] some costs now in order for you to get used to and build around AWS, and likely build more closely to AWS. If it ends up being successful, AWS has a much larger customer.
[0] I say subsidize in quotes because I seriously doubt AWS is taking a loss on any of this, they're just not making quite as much in profit.