Paul is using an illustration that has confused readers since he wrote it. but the context seems to make clear that "death" is used as a metaphor for baptism. A key concept is that in Roman era slave's debt ends with his death. Describing sin as a slaveholder (v. 6), Paul states: "For we know that our old self was crucified with him so that the body of sin might be done away with, that we should no longer be slaves to sin, because anyone who has died has been freed from sin" (Romans 6:6-7).
The most confusing line is "For the wages of sin is death, but the gift of God is eternal life in Christ Jesus our Lord" (v. 23). Slaveowners did pay their slaves a meager subsistence wage. Sin, as a cruel master. however only offered death as a wage.
To interpret Romans 6 as suggesting sins are erased at death is to negate the purpose/s of the Christ sacrifice. Mind you there were very many opinions regarding the latter, but Paul never elsewhere suggested that at death a person's sins were erased.
Confusing, even in context, but the surrounding text does make clear he was referring to baptism as death.