I mean, this accomplishes getting the text on the same line with different weights, but it’s not semantic. If this is a header, use one tag and use a span with a class that styles the text within that span or use strong. If it’s just regular text, use a paragraph tag and do the same. In the examples given, you’re splitting up one piece of text amongst two separate tags to achieve a side effect of them being in separate tags, and that is a bad idea for a number of reasons.
Edit: Of course, if what you REALLY want is an h1 tag and an h2 tag on the same line, this is the way to go. But I’m just not thinking that’s the actual need here from the examples provided.