The Border’s Positioning dictates which Layer an object will snap to the Borders.
Set the Border’s Positioning direction from the Border Properties.
Select Top Layer to snap the object’s Top Layer to the Borders.
Select Bottom Layer to snap the object’s Bottom Layer to the Borders.
This is especially important when using the Dynamic Outsides.
See: Borders Default Settings
See: Border Properties
See: Dynamic Outsides Definition