The bug
Players can bounce on beds even if they don't directly touch the bed's surface. This can be tested by placing a trapdoor above the bed and jumping on the trapdoor; the player will be bounced back up as if he jumped on the bed, not the trapdoor.
Related issues
is duplicated by
Attachments
Comments

This is caused by MC-1133. However, as opposed to that issue, this issue could be prevented by checking whether the player is actually standing on top of the bed (on the correct y coordinate).
Can confirm in 20w49a.
Can confirm in 20w51a.
Can confirm in 21w03a.
Can confirm in 21w06a.
Can confirm in 21w15a.
Can confirm in 1.17.
Can confirm in 1.17.1.
Can confirm in 1.18.1.
Can confirm in 1.19.2.
This issue was present in 23w17a but no longer occurs in 23w18a. This issue has been fixed in 23w18a.