Even if we have the gamerule keepinventory true we lose the effects of potions when we die.
To reproduce:
1 - to put the gamerule keepinventory has true.
2 - put itself an effect of any potion.
3 - to kill with / kill
4 - to observe that the potion disappeared.
WAI. keepInventory only applies to items / blocks in the inventory.