Lie algebras under constraints and non-bijective canonical transformations