There's no way anyone apart from the original designer / installer could say what the reason was for that.
Is this a random photo found on an internet search or is it your photo?
Is it / they in the U.K and outside, lack of lagging would suggest not U.K unless it's inside, maybe in stables?
Are both of them in the same pipe run?
Are there anymore in the same installation?
More possibles to add to the list,
Flow restrictor.
(very small) Solar heat exchanger
Shock arrester, I'm not convinced the marble has anything to do with the device, but does it jump up if you turn the tap off quickly.?
Other ideas to follow,,