They aren't replacing delivery trucks that stock stores, it's adding to personal deliveries usually done by normal bike or sometimes car depending on the traffic density.
Amazon deliveries in NYC are done by a mix of bikes with trailers, the US Postal Service, Amazon's own Sprinter vans, and third-party contractors using their own vehicles (e.g. Lasership). The bikes and trailers are replacing these vehicles, not a normal bike.