La versión simple de tabulación cruzada de un pivot()
se vería así:
select
dfips
, dcounty
, mail_sumton = sum(case when context = 'mail' then sumton else null end)
, rail_sumton = sum(case when context = 'rail' then sumton else null end)
from t
group by dfips, dcounty