Factual error: When you walk into the courthouse the first jailhouse to the left has a window. But the courthouse is connected to another establishment on that side. A window would be impossible.
Factual error: The badges they wear don't match the badges on their patches. If there's a badge on the patch, it's supposed to match their actual badge.
Factual error: A town like Mayberry with a mayor and council would have its own police force, not just a sheriff.
Answer: Those "boxes" are valences that used to be very common, before air conditioning. They allow for windows to be open during rain storms. They permit air circulation, without letting the rain in.