It is interesting when you juxtapose this Scripture with I Chronicles 21 which is its parallel Scripture. When you look at vs.1 you see that the Lord was furious with the people and so kind of egged David on to take a census, which was not the desire of the Lord. We read in Chronicles that it was Satan who egged David on to take the census. These two Scriptures are identical except in the one that we have for today it is God who is angry with the Israelites. In Chronicles it is Satan, that is the only difference.
When we pray in the Lord's prayer: Do not lead me into temptation, we know that we have a God who is the giver of all good and perfect gifts. When you read in James 1:13 that God does not tempt then we ought to know for sure that God is not the one who sets up scenarios hoping and waiting for us to fail. David recognizes his sin, is given options on how he is to be punished, and decides that he will leave his future up to the Lord, and not up to people.
A plague strikes the land and God gives David a way out, which was what he was hoping would happen. He goes down and buys a tract of land from one of his citizens in order to offer sacrifices to the Lord. The person wants to give it to the king, after all, it is the king, but David says: "I am not going to give to the Lord anything that is free to me." What we give to the Lord has much to do with what we have been given by the Lord.