Smith had raised hopes of ending Britain's 116-year wait for an Olympic gymnastics champion after he topped qualifying, but he could not match the flamboyant power and precision of Berki's routine, who edged the gold thanks to a higher execution score.
The duo both earned 16.066, leaving Smith looking rather disappointed when his ranking flashed up but with team mate Max Whitlock earning bronze, it was the most successful day for British gymnastics at an Olympics.
Smith and Whitlock had been given a huge reception by the British fans at the North Greenwich Arena, whose number included Prince William's wife Kate wearing a navy blue British team top and sitting with the gymnasts' team mates.
The 23-year-old Smith, a bronze medallist on the same apparatus in Beijing four years ago, was drawn last and had to sit and wait for his turn as the other seven finalists stepped up.
When the 27-year-old Berki, long-legged for a gymnast at 1.78 metres tall, produced his smooth routine that ended with a big contingent of flag-waving Hungarian fans cheering to the rafters, Smith knew his work was cut out.
Though his routine was harder - with a difficulty score of 7 to Berki's 6.9 - the Hungarian scored 0.1 better on execution, the score that is taken into account for a tiebreak.
"I'm a big fan of Louis Smith's although he's much younger than me. I expected him to win, but today I was better," Berki told reporters.
Smith, who had never scored over 16 in a major international competition, said he was satisfied with finishing second behind his friend Berki.
"You have to look at the positives," he told a news conference. "I can't sit here with my face screwed up just because I got a silver at the Olympic Games. Great Britain are making history - it's a fantastic day for the sport."