There is a fiscal crisis looming over Massachusetts’ state prisons and county jails. The inmate population is aging, and the cost of providing health care to older inmates, particularly those who are suffering from terminal ailments, is beginning to strain budgets.