Federal court rules in favor of Catholic dioceses, ministries