It will work if you explicitly enter 0
for the top margin, rather than leave the margin control empty.
A bit of background information to help explain this.
In a block theme everything is a block; the header, the main group block containing the page content, individual blocks within the page content, headings, paragraphs, images etc.
WordPress uses a blockGap
variable, and this is applied to provide spacing between blocks. Most of the time this is visually better (or it was decided by those building WordPress to be better) than having no visible space between blocks.
In your case it would be better to not have any spacing between the header and the page content, so this can be overridden for the main group block containing the page content by setting the top margin to 0
for the main group block in the page template(s).
If you leave the margin setting empty, the top margin will effectively default to the blockGap
variable which is 1.5rem
in the Twenty Twenty-Two theme.
This affects all block themes, and each theme can define what the blockGap
should be.
There does seem to be an issue with the space only appearing in the live site and not in the editor. They should be identical but that is another issue.
Hope this helps.