Both legs qualify. You stopped reading too quickly.
No FL at SFO, so no Dining. But, you would qualify if there were a FL.
No access to Dining at JFK, but you do have access to the FL as you are travellling in J.
How you get into F or J, e.g. paid, vs. redemption vs. UG is not relevant.