I found (and exploited) a bug
You need 2 different blocks. Let's use wood and grass.
1. Start putting down grass block, but don't plant it. Ghost block should appear.
2. Swap equipped block to wood.
3. Put down wood before ghost grass block disappears.
4. You will plant grass block, but it won't vanish from your inventory. Instead, one wood block will be consumed.
5. Proceed to turn wood/grass/dirt/sand into stone/other expensive blocks.
You need 2 different blocks. Let's use wood and grass.
1. Start putting down grass block, but don't plant it. Ghost block should appear.
2. Swap equipped block to wood.
3. Put down wood before ghost grass block disappears.
4. You will plant grass block, but it won't vanish from your inventory. Instead, one wood block will be consumed.
5. Proceed to turn wood/grass/dirt/sand into stone/other expensive blocks.