So I figured, "It must cost less if I were to take the flight directly from London". It turns out I'm wrong, and by huge margin!
The same flight, on the same day and hour, from London Heathrow to Rio de Janeiro, costs $4600. That's 50% more expensive, and it doesn't even include the Budapest to London flight!
I looked online and found a good explanation: Why Does My Connecting Flight Cost Less Than a Nonstop? (Ask Cranky) | The Cranky Flier
Now, I knew that airlines have different tactics to maximize their profits, like overbooking, knowing that a part of the passengers will miss the flight, but I didn't think they'll go this far.
I wonder if it's possible to book the cheaper flight, the one with connections, and just show up at London Heathrow for the second flight.