Optimal elliptic regularity: a comparison between local and nonlocal equations