The corrupt officials of a small Russian town, headed by the Mayor, react with terror to the news that an incognito inspector (the revizor) will soon be arriving in their town to investigate them. The flurry of activity to cover up their considerable misdeeds is interrupted by the report that a suspicious person has arrived two weeks previously from Saint Petersburg and is staying at the inn. That person, however, is not an inspector; it is Khlestakov, a foppish civil servant with a wild imagination.
Having learned that Khlestakov has been charging his considerable hotel bill to the Crown, the Mayor and his crooked cronies are immediately certain that this upper class twit is the dreaded inspector. For quite some time, however, Khlestakov does not even realize that he has been mistaken for someone else. Meanwhile, he enjoys the officials' terrified deference and moves in as a guest in the Mayor's house. He also demands and receives massive "loans" from the Mayor and all of his associates. He also flirts outrageously with the Mayor's wife and daughter.
Sick and tired of the Mayor's ludicrous demands for bribes, the village's Jewish and Old Believer merchants arrive, begging Khlestakov to have him dismissed from his post. Stunned at the Mayor's rapacious corruption, Khlestakov states that he deserves to be exiled in chains to Siberia. Then, however, he pockets still more "loans" from the merchants, promising to comply with their request.
Terrified that he is now undone, the Mayor pleads with Khlestakov not to have him arrested, only to learn that the latter has become engaged to his daughter. At which point Khlestakov announces that he is returning to St. Petersburg, having been persuaded by his valet Osip that it is too dangerous to continue the charade any longer.
After Khlestakov and Osip depart on a coach driven by the village's fastest horses, the Mayor's friends all arrive to congratulate him. Certain that he now has the upper hand, he summons the merchants, boasting of his daughter's engagement and vowing to squeeze them for every kopeck they are worth. However, the Postmaster suddenly arrives carrying an intercepted letter which reveals Khlestakov's true identityâand his mocking opinion of them all.
The Mayor, after years of bamboozling banter Governors and shaking down criminals of every description, is enraged to have been thus humiliated. He screams at his cronies, stating that they, not himself, are to blame. While they continue arguing, a message arrives from the real Government Inspector, who is demanding to see the Mayor immediately.

Question: Who actually was the person they thought was the inspector?
Answer: Khlestakov
Alternative answer: Khlestov, a vagabond