Moderna had earlier posted a loss of $2.52 per share a year earlier, while analysts expected a loss of $3.96 per share.