Both ammonia and carbon dioxide behave in a similar way in water. CO2 dissolves to form a relatively unstable acid--carbonic acid and ammonia dissolves to form a relatively unstable alkali--ammonium hydroxide. They will both revert to the gasseous state relavely easily with a rise in temperature, agitation or allowing oxygen to take their place. This will not replace all the gas that is dissolved but will reduce it in both cases.
The problem with the use of ammolock is that it locks up the ammonia and therefore destroys the equilibrium between the good bacteria and their food source, so that as the bacteria die off from a lack of food an ammonia spike is likely later when the bacteria have all died or been reduced but the fish are still producing ammonia/urea etc.