The regional court in the western city of Osnabrück said the defendant, identified only as 57-year-old Siegfried K., arrived at the bank branch, now equipped only with cash machines, with a toy gun in May.
He seized a female "hostage" in the lobby of the building to demand a €10,000 ($13,483) ransom from bank employees.
"This plan failed however due to the fact that the building has not held a bank for more than a decade but rather a physiotherapy practice," the court said in a statement.
Bild said the bank had moved out 17 years ago.
"After the defendant recognised the situation, he changed his plan and demanded a passer-by withdraw money from the cash machine," the court said.
"She withdrew €400 and the defendant made off with the cash in a car he had stolen."
He later abandoned the vehicle but left the plastic pistol, covered with his fingerprints, between the seats.
Story continues below…
The court said Siegfried K. had confessed to the robbery and judges handed down a seven-year sentence on Tuesday due to 22 previous convictions over the last 40 years.