Shekalim 4:2-3
Shekalim 4:2
The red heifer, the goat for Azazel and the red wool (used in the Yom Kippur service) are paid for using communal funds from the Temple treasury. The ramp for the heifer, the ramp for the goat, the thread between the goat’s horns, the channel of water in the Temple, the Jerusalem city wall and its towers, and all city needs were paid for using money left in the treasury after the sacrificial needs were met. Abba Shaul said the kohanim paid for the ramp for the heifer using their own funds.
Shekalim 4:3
The surplus money left in the treasury after everything was paid for was used to buy wine, oil and fine flour. These were sold to those who needed them for libations and flour offerings, with the profit going to the Temple. This is the position of Rabbi Yishmael; Rabbi Akiva says that consecrated money could not be used in for-profit ventures (because it is unseemly for the Temple to engage in business). The money of needy people could also not be used in business because they need access to it and can’t afford to have it tied up.