Is it possible for Block level element inside of an In-line element?

I read that in HTML, a block-level element can’t be used inside of an In-line element. For example, <span>Hi <div>!</div></span> is not possible as <span> is an In-line element and <div> is a Block-level element.
But, I also read that <a></a> is an In-line element and have frequently seen <div> tags being used inside of a <a> tag. How is this possible and what am I missing?