Happened to me on EC2 once. They cut me a break and gave me 20-30% discount. They can though, because the idle machines were not costing them any money.
They weren't costing Amazon any money if they had excess capacity, but if those machines being in use prevented them from being sold to someone else then they did cost it.
This didn't happen to me, but that's only because I set up dozens of post-its and alarms reminding me to quit those tests I was running on EC2. That's perhaps the one web-service that has made me the most paranoid.