Scotland’s First Minister has given farmers a “cast-iron” guarantee to return £46 million taken from the agriculture budget to combat the cost-of-living crisis.