The ending is kind of a happy one: bandits dead, village saved and samurai victorious. So why, then, does it leave us feeling like we just got slugged in the gut?
For starters, it comes at a cost. Four of the samurai are killed, along with a number of peasants, and the surviving three are left alone without even a word of thanks. The farmers go back to their fields, singing happily while Kambei, Katsushiro and Shichiroji stare mournfully at the graves of their brethren. It's harsh, but it's the world they're living in. The peasants love them for as long as they're needed, only to cast them aside when the danger has passed.
That leaves the three survivors damaged in ways that their fallen colleagues could never be. For Kambei and Shichiroji, it means dealing with another fun-filled round of survivor's guilt. We've inferred from their earlier dialogue that they are the only survivors of the battle that killed their lord, which meant watching all their friends die and realizing that they couldn't fulfill their oath and duty by dying alongside them.
Katsuhiro, the young man coming of age on this adventure, has to deal with pain of an entirely different sort. He's in love with Shino, and she might be in love with him, but even in a world turned upside down, a farmer's daughter and a samurai just can't be together. He's devoted to the ideals of bushido and she could never defy her father or her community. That leaves him staring at her like a wounded puppy as she walks away to join her village in the rice paddy.
That's hardly a hero's reward, especially for three men who fought so hard and surrendered so much. It tinges the victory with tragedy beyond just losing four awesome samurai in the battle. This is the samurai's lot now: no honor, no reward, just the relief of victory and the fleeting satisfaction that they saved a bunch of people who couldn't care less about them. They'll have to trudge on down the road to their next destination, carrying their inner pain with them and searching futilely for some new way to give their lives meaning.
It's not the kind of "victory" you usually see in big epic movies: empty and hollow without any sense of accomplishment and a whole lot of loss to deal with. But again, it fit right in with the national mood of Japan at the time. Having been soundly defeated in World War II and forced to accept surrender—which would have been unthinkable before the war—the Japanese needed to acknowledge the loss of the past with the hope of the future.
In that interpretation, the farmers are the people of Japan, moving forward with life the way they need to. The samurai are the outdated past, a past they can no longer embrace, and though their code may be intact, the world has moved on without them.
It's tragic in a lot of ways, but it's also what the country needed to hear. The rest of us can take heart from the same message: learning to live with things we thought we couldn't and accepting heroic acts in our own lives as rewards unto themselves. The mixture of emotions that Kurosawa creates, bumming us out in the middle of a big win, helps it resonate and remains one of the reasons why filmmakers still draw inspiration from it sixty years down the line.