The robbers, who broke into the bank Tuesday, had taken over 20 people as hostages, but released 18 of them Wednesday morning.
According to the BBC, witnesses told local media five men had tried to rob the bank in the tourist town some 120 km northwest of the capital San Jose, but the raid turned into a shoot-out.
While two of the gunmen died in an exchange of fire with guards outside the bank, the others took some 20 hostages, of whom 16
The slain policeman was said to be former presidential security head Oscar Quesada, who was shot when he tried to enter the building with others Wednesday.
The last of the hostage takers surrendered late afternoon Wednesday.