It does exactly what it is designed for, namely wrap marked text with a code tag. Marking multiple lines as code is not it’s task. Therefore you want to use the “preformatted” format from the headlines dropdown. That will render a pre tag. Semantically best practice for a “code sample paragraph” is to use a preformatted paragraph and code command button. Result:
<pre><code>...</code></pre>