When STATISTICS TIME is set to ON you get time stats for each statement in the batch, so it might print a huge number of statistics.
This is not the case with the UDF you posted. I tried to reproduce on my laptop the behaviour you noticed, but it doesn't occur. I'm using SQL Server EXPRESS 2008, but it shouldn't matter.
Anyway STATISTICS TIME is not very accurate and doesn't always tell the truth, so you might prefer using profiler to measure performance.