Fred Clark makes an interesting point, to which I would just add: there isn't a whole lot of punishing going on in the Hebrew Scriptures.
I know the "popular" image of God in the Hebrew scriptures is the vengeful one, the "sinners in the hands of an angry God" which is so much a part of American culture (and one more reason the past isn't over, or even passed). But, as the Yale website indicates, everything is subject to interpretation; and re-interpretation.
And my starting point for this would not be the prophets nor the histories in the Hebrew scriptures, but the wisdom literature: specifically, the book of Job. Do we consider Job when we consider the question of punishment? No, if only because the prologue to Job makes it clear Job is not being punished for anything, despite what his friends think. Job is not being punished because Job is righteous; but also because Job's life has become the game board in a cosmic game is being played out between God and Satan. There's something, indeed, almost Hellenistic about the book of Job; but I digress. The point is, nowhere in the book is Job's suffering properly identified as punishment; in part because it isn't, in part because such punishment is manifestly unjust. As much as Job is a very Hebraic meditation on the question of theodicy (and in Hellenistic terms, on the issue of fate and our mortal relationship to the immortal and powerful gods), it is a meditation on the nature of justice. Is what happens to Job unjust? Only in the sense that justice is something meted out to those who have violated some standard of conduct. But that's not the only sense of justice espoused in the Hebrew scriptures.
The primary discussion of justice is conducted among the prophets, and their subject is the apostasy of Israel that leads to the fall of the two kingdoms and the Exile. But the sin of apostasy is not punished by God through the Babylonians. It is not God who punishes Israel at all; it is Israel who punishes itself, because God leaves them to the consequences of their actions. Indeed, what choice does God have? God neither punishes Israel, nor removes God's magic shield of protection from Israel. God just tells Israel, through the prophets, how badly they screwed up, and what the consequences of their behavior is gonna be. Oh, yeah, and in several famous scenes scattered throughout the works of the prophets, God challenges Israel to point out where God failed and caused Israel to collapse.
Then God comes along and picks up the pieces, and promises to put Israel back together again:
1 The hand of the LORD was on me, and he brought me out by the Spirit of the LORD and set me in the middle of a valley; it was full of bones. 2 He led me back and forth among them, and I saw a great many bones on the floor of the valley, bones that were very dry. 3 He asked me, “Son of man, can these bones live?”Ezekiel 37:
I said, “Sovereign LORD, you alone know.”
4 Then he said to me, “Prophesy to these bones and say to them, ‘Dry bones, hear the word of the LORD! 5 This is what the Sovereign LORD says to these bones: I will make breath[a] enter you, and you will come to life. 6 I will attach tendons to you and make flesh come upon you and cover you with skin; I will put breath in you, and you will come to life. Then you will know that I am the LORD.’”
7 So I prophesied as I was commanded. And as I was prophesying, there was a noise, a rattling sound, and the bones came together, bone to bone. 8 I looked, and tendons and flesh appeared on them and skin covered them, but there was no breath in them.
9 Then he said to me, “Prophesy to the breath; prophesy, son of man, and say to it, ‘This is what the Sovereign LORD says: Come, breath, from the four winds and breathe into these slain, that they may live.’” 10 So I prophesied as he commanded me, and breath entered them; they came to life and stood up on their feet—a vast army.
11 Then he said to me: “Son of man, these bones are the people of Israel. They say, ‘Our bones are dried up and our hope is gone; we are cut off.’ 12 Therefore prophesy and say to them: ‘This is what the Sovereign LORD says: My people, I am going to open your graves and bring you up from them; I will bring you back to the land of Israel. 13 Then you, my people, will know that I am the LORD, when I open your graves and bring you up from them. 14 I will put my Spirit in you and you will live, and I will settle you in your own land. Then you will know that I the LORD have spoken, and I have done it, declares the LORD.’”Isaiah 40:
1 Comfort, comfort my people,
says your God.
2 Speak tenderly to Jerusalem,
and proclaim to her
that her hard service has been completed,
that her sin has been paid for,
that she has received from the LORD’s hand
double for all her sins.
3 A voice of one calling:
“In the wilderness prepare
the way for the LORD[a];
make straight in the desert
a highway for our God.[b]
4 Every valley shall be raised up,
every mountain and hill made low;
the rough ground shall become level,
the rugged places a plain.
5 And the glory of the LORD will be revealed,
and all people will see it together.
For the mouth of the LORD has spoken.”
6 A voice says, “Cry out.”
And I said, “What shall I cry?”
“All people are like grass,
and all their faithfulness is like the flowers of the field.
7 The grass withers and the flowers fall,
because the breath of the LORD blows on them.
Surely the people are grass.
8 The grass withers and the flowers fall,
but the word of our God endures forever.”
9 You who bring good news to Zion,
go up on a high mountain.
You who bring good news to Jerusalem,[c]
lift up your voice with a shout,
lift it up, do not be afraid;
say to the towns of Judah,
“Here is your God!”
10 See, the Sovereign LORD comes with power,
and he rules with a mighty arm.
See, his reward is with him,
and his recompense accompanies him.
11 He tends his flock like a shepherd:
He gathers the lambs in his arms
and carries them close to his heart;
he gently leads those that have young.
12 Who has measured the waters in the hollow of his hand,
or with the breadth of his hand marked off the heavens?
Who has held the dust of the earth in a basket,
or weighed the mountains on the scales
and the hills in a balance?
13 Who can fathom the Spirit[d] of the LORD,
or instruct the LORD as his counselor?
14 Whom did the LORD consult to enlighten him,
and who taught him the right way?
Who was it that taught him knowledge,
or showed him the path of understanding?
15 Surely the nations are like a drop in a bucket;
they are regarded as dust on the scales;
he weighs the islands as though they were fine dust.
16 Lebanon is not sufficient for altar fires,
nor its animals enough for burnt offerings.
17 Before him all the nations are as nothing;
they are regarded by him as worthless
and less than nothing.
18 With whom, then, will you compare God?
To what image will you liken him?
19 As for an idol, a metalworker casts it,
and a goldsmith overlays it with gold
and fashions silver chains for it.
20 A person too poor to present such an offering
selects wood that will not rot;
they look for a skilled worker
to set up an idol that will not topple.
21 Do you not know?
Have you not heard?
Has it not been told you from the beginning?
Have you not understood since the earth was founded?
22 He sits enthroned above the circle of the earth,
and its people are like grasshoppers.
He stretches out the heavens like a canopy,
and spreads them out like a tent to live in.
23 He brings princes to naught
and reduces the rulers of this world to nothing.
24 No sooner are they planted,
no sooner are they sown,
no sooner do they take root in the ground,
than he blows on them and they wither,
and a whirlwind sweeps them away like chaff.
25 “To whom will you compare me?
Or who is my equal?” says the Holy One.
26 Lift up your eyes and look to the heavens:
Who created all these?
He who brings out the starry host one by one
and calls forth each of them by name.
Because of his great power and mighty strength,
not one of them is missing.
27 Why do you complain, Jacob?
Why do you say, Israel,
“My way is hidden from the LORD;
my cause is disregarded by my God”?
28 Do you not know?
Have you not heard?
The LORD is the everlasting God,
the Creator of the ends of the earth.
He will not grow tired or weary,
and his understanding no one can fathom.
29 He gives strength to the weary
and increases the power of the weak.
30 Even youths grow tired and weary,
and young men stumble and fall;
31 but those who hope in the LORD
will renew their strength.
They will soar on wings like eagles;
they will run and not grow weary,
they will walk and not be faint.
It's not about punishment; it's about consequences. It's not about justice as punishment for wrongs done, or as suffering before lessons are learned. It is about justice as mercy, and redemption. God is not just because God abandons Israel. God is just because God restores Israel. Justice is not a consequence free life. Justice, as Martin Luther King said, is the telos toward which the arc of the universe is bent.
Fred references one of the semeia of John, the man born blind whose sight is restored. The disciples think justice is punishment for sins done, by the man or his parents. Jesus knows that is not justice, and he uses the man as a sign, a semeia, of God's work (as all the semeia are meant to be seen in John's gospel). In the synoptics the healings and other signs of God's power are dunamis, or acts of power. What they show, time and again, is that justice is accessible to us all, and justice is most important as an action, not an abstract concept. Especially in the synoptics the dunamis reveal that justice is active, not deliberative. When Jesus makes the lame walk and the blind see, he never does it because they deserve his attention, but because they deserve our attention. Do you see this woman? How do you see her? As a prostitute? A female? A child of God? The distinction is crucial; but it is crucial to us. If justice is going to be done on this earth, it must come from us. It does not fall down on us from God, any more than punishment falls down on us from God. What comes from God is justice; what we suffer is the consequences of our own actions. Can we complain against God for not saving us from ourselves? The children of Abraham have been doing so almost since the first children of Abraham. Does that make God unjust?
No. Only our definition of justice is unjust; especially when we limit who justice is done for, or think of justice as who it is done to.