Such boards may expend from the county general fund the moneys necessary to pay the whole or any part of the cost of the improvement of any highway lying within any city in the county, whenever any real property belonging to the county and used for public purposes is included within the assessment district formed to pay for any such improvement. Such expenditures shall not exceed the amount which, but for such public ownership and use, would be properly chargeable to and assessed against such real property under the provisions of the law governing such improvement.