Potentially it could be subsidising the cost of the main race, if there are road closures etc to be taken into account (ok, not the case for your trail run). Difficult to say and it would vary from event to event.
I guess it will make a difference if the event is run by an events company, which is primarily there to make profit, or organised by a club, who want to cover their costs and possibly raise some funds for other club activities. I'd balk at the former, but if my local club organised an event which had a fundraising element, meaning the club could offer better facilities/coaching to it's members, I'd be ok with that.
At the Loch Ness Marathon there's a "Wee Nessie" race which is, as you describe, 400m or so round the park next to the event "village". Cost £3 each last time my 2 did it - but they got a printed t-shirt and a quality medal! I suspect the marathon entry subsidised the junior race that time.