Nobel Prizes aren't just given to Presidents. His campaign lasted two years and the committee as I understand it is awarding him based on the new hope he has created globally. He could've received this if he wasn't elected.
If he wasn't elected President, then all the good hope and rainbows would not have become part of a changing world image of America ELEVEN DAYS BEFORE the nomination.