Can anyone explain this strange behavior of InputForm?

I consider this a bug in the front end. Very odd it is, that not all forms eat up the first result. Consider this simple example

m = {1};
MatrixForm@m
MatrixForm@m

which gives 2 outputs as expected. If we look on the traffic between kernel and front end, then we see, that the kernel indeed sends 2 outputs back. No matter which kind of form we use:

FE <--- K: OutputNamePacket["Out[3]//TeXForm= "]
FE <--- K: ReturnInputFormPacket["\\{1\\}"]
FE <--- K: OutputNamePacket["Out[4]//TeXForm= "]
FE <--- K: ReturnInputFormPacket["\\{1\\}"]

Unfortunately, when using TeXForm or InputForm or CForm (I haven't tried all) the first (!) output cell is always lost. This can be seen, if you watch the In[] and Out[] numbers. For In[n] you get Out[n+1], where it should be both Out[n] and Out[n+1].

If you don't have LinkSnooper set up like I have, you can set $Post to see, that really two outputs are created but they are just not displayed. Try this

$Post = (Print[#]; #) &
InputForm@m
InputForm@m

I suspect that this has something to do with the code that produces the InputForm cell tags, or rather tagged cells. In addition to the last tagged cell replacing the prior ones you can observe strange behavior when combining CellPrint and InputForm:

InputForm[1 // CellPrint]
InputForm[2 // CellPrint]
InputForm[3 // CellPrint]
1

Out[1]//InputForm= 2

Out[2]//InputForm= 3

Out[3]//InputForm=
Null

The actual return from CellPrint is Null, so the fact that 2 and 3 end up on an InputForm-tagged cell may be a bit of a surprise.

You can also observe that the InputForm-tagged cells are not produced in the normal output process as they end up at the bottom, and further observe that the tagging is missing in this case:

1
2
InputForm[3]
InputForm[4]
5
Out[1]= 1

Out[2]= 2

Out[5]= 5

4

As a workaround, you can proceed in a fashion similar to my answer to Multiple TeXForm returns just single output:

InputForm[E] //SequenceForm
InputForm[Pi] //Defer

E

Pi

It is possible to create a new *Form so that the form wrapper gets stripped from Out, as I describe in my answer to How to make the result of InputForm balance the bracket:

Unprotect[$OutputForms];
AppendTo[$OutputForms, myInputForm];
Protect[$OutputForms];

myInputForm /: MakeBoxes[myInputForm[expr_], StandardForm] := MakeBoxes[
    InputForm[expr]
]

Then:

$Line=0;

InputForm[E] //SequenceForm
Row[{a, b}] //myInputForm
SparseArray[{}, 3] //myInputForm

E

Row[{a, b}]

SparseArray[Automatic, {3}, 0, {1, {{0, 0}, {}}, {}}]

Let's check the FullForm of the outputs:

FullForm[{Out[1], Out[2], Out[3]}]

List[SequenceForm[InputForm[E]],Row[List[a,b]],SparseArray[Automatic,List[3],0,List[1,List[List[0,0],List[]],List[]]]]

As you can see, the myInputForm wrapper does get stripped, unlike the first example. Using the myInputForm wrapper also allows you to use double click to select parts of the expression, unlike the usual InputForm wrapper.