Can RaycastHit2D.point be inside a BoxCollider2D if raycast was performed from outside that collider?

I’m working on a 2D platformer without using physics. Sometimes happens that my character, moving to the right, gets stuck inside a wall. My code is:

//horizontalSpeed is > 0
RaycastHit2D hit = Physics2D.Raycast(transform.position, Vector2.right, horizontalSpeed, LayerMask.GetMask("Walls"));
if (hit)
{
	float margin = 0.01f;
	transform.position = new Vector2(hit.point.x + boundingBox.offset.x - boundingBox.bounds.extents.x - margin, transform.position.y);
	horizontalSpeed = 0;
}
else
	transform.position = new Vector2(transform.position.x + horizontalSpeed, transform.position.y);

Could this problem be caused by hit.point to be inside the Wall’s box collider instead of being on the edge?

No, it will always be a contact point outside of the collider. The only exception is if the start point of the ray is inside the collider but whether this point is returned or not is controlled via the following property: Physics2D.raycastsStartInColliders