Compression really has little to do with it. The air is compressed on the compression stroke (naturally) and then pushes the piston back down on what would normally be the power stroke. So it's essentially an air spring.
Jake brakes work by releasing the compressed air at the top of the compression stroke. This means energy is used to compress the air but none is returned by the air pushing the piston back down. It's a very effective system.
Others have already mentioned how gasoline compression and what we consider normal diesel exhaust brakes work. They are effective, but not as much as the Jacobs, or "Jake" brake since they don't release energy from the system. (They're not nearly as loud either.)