On the mechanism of negative compressibility in layered compounds