Banks who provide loans should be involved in the sale of produce. If SBI gives a farmer loan, SBI maybe with NABARD should be the unit that is involved with purchase of his produce and sale, so as to recover some part of his loan.
Waiving of loans in election year will lead to complacent farmers who will take a loan and do nothing, hoping for a waiver every 5 years.
Furthermore, investments into rain harvesting and pipe based irrigation to fields will be cheaper than waiving off loans.