Thanks to their good relations with the pashas, the Barinkay family of southern Hungary succeeded in amassing a huge fortune during the Turkish occupation of their country. However, when the Turks were expelled from the land, Gáspár Barinkay also had to flee. The landlord hid his treasure somewhere on the estate, went into hiding and died. With the estate then being confiscated by the emperor, Barinkay's wife also fled and raised their son, Sándor, alone in the Balkans. Years pass, and in the time of Maria Theresa, a general amnesty is announced for the exiles, with the estates returning to their rightful heirs. After travelling the world trying to make a living as a circus performer, the young Sándor Barinkay wakes up one fine day to learn that he is now the lord of a 16,000 acre estate in the Banat of Temes. All he has to do is settle down there.
Sándor Barinkay is accompanied to his estate by Count Carnero, an Imperial counsellor and third vice chairman of the Commission on Public Morality in Vienna, who ceremonially returns the land to him by the grace of the empress. The manor, however, has been replaced by a swamp, while the ruined Barinkay Castle has been occupied by the filthy rich pig dealer Zsupán and his daughter, Arsena. Of the famous treasure there is no trace. Two witnesses are required as a formality, so first they knock on the door of the Gypsy woman Czipra, who lives nearby. The woman predicts that Barinkay will soon be a happy man: a dream on his wedding night will shed light on where his father hid the treasure. Called to act as the second witness is Zsupán, to whom Barinkay immediately begins to complain about his castle. Finally, the young man makes him an offer: if Zsupán's daughter really is pretty and will marry him, then he'll be willing to drop the lawsuit. Next to arrive is the girl's governess, Mirabella, who is greatly surprised to find Carnero, her long-lost husband: 24 years earlier, during the Battle of Belgrade, fate separated them when Mirabella was taken prisoner by a Turkish pasha. Their son, Ottokar, works as a music teacher in the Zsupán household, showering Arsena, the daughter of the “pork king” with tender emotions. The stunning girl herself arrives, and Barinkay asks her to marry him. Arsena, however, is in love with Ottokar and, wishing to avoid a forced marriage, states that the man who seeks her hand in marriage must be at least a baron in rank. Barinkay is left alone, discouraged at being greeted at his estate by nothing but a swamp and a haughtily recalcitrant bride.
Saffi, Czipra's daughter, arrives and utterly enchants Barinkay with her singing. The other Gypsies also arrive and elect Barinkay their “vajda”, or chieftain. The young man wakes up the Zsupán household to let the pompous inhabitants know that he has been made a baron – a Gypsy baron – but that instead of marrying Arsena, he takes Saffi for his wife. The Gypsies and the members of the Zsupán household face off antagonistically.
Barinkay and Saffi have consummated their love. On their wedding night, Czipra dreamed about where Barinkay will find the treasure he is lawfully entitled to, which indeed proves to be where the valuables are hidden.
At dawn the Gypsies get to work forging weapons, as the empire is at war. Zsupán's people appear, maintaining that Barinkay's marriage to the gypsy girl is both immoral and illegal. Barinkay nevertheless affirms that Saffi is his wife. When questioned, they relate that they were married not by a priest, but by a pair of storks. General mayhem breaks out when Zsupán and his people notice the magnificent necklace on Saffi's neck and suddenly realise that Barinkay and his companions have found the famous treasure!
Right then, Colonel Homonnay marches in at the head of a troop of hussars, there to recruit soldiers for the army of Empress Maria Theresa. Carnero reports Barinkay to Homannay for concealing treasure from the authorities, but then is forced to eat his words when Barinkay voluntarily hands over his treasure for use by Maria Theresa's army. Nevertheless, Carnero continues with his accusations, citing the landlord for letting himself be seduced by a Gypsy girl. Czipra won't stand for any more of this censure and produces a document that reveals that she is not in fact Saffi's mother. Instead, the girl is the daughter of the pasha of Temes, meaning that she was born a princess! Homonnay marches out together with his newly recruited soldiers: Barinkay and the Gypsies, joined by Zsupán and Ottokar, who have unwittingly drunk from the recruiter's wine and thus now must go to war.
In the fabulous city of Vienna, news reaches Mirabella, Carnero and Arsena that the hussars have triumphed, and the war is over. Maria Theresa herself personally greets the troops returning home from battle. Homonnay praises his soldiers one by one: Zsupán, who did a fine job of lining his pockets on the battlefield, Ottokar, who bucked up the troops with his singing, and Barinkay and his Gypsies, whose blacksmithing work repairing the damaged cannons proved an invaluable service. Maria Theresa gives Barinkay a triple award for giving up his fortune and his love in order to serve the empire. She'll return Barinkay's entire fortune, make him a baron and give him a wife. Barinkay gratefully declines, asking to remain a simple Gypsy baron. He again asks for Arsena's hand – but not for himself: he asks for her to be Ottokar's wife. Then Princess Saffi appears – she is now a lady-in-waiting to Maria Theresa. Barinkay sadly informs the empress that although he loves Saffi, the life of a baron or prince is not the one for him, so he'd prefer to return to the wandering life of a circus performer. Saffi also happily chooses the life of the circus over the glittering world of the Imperial court.