Let's consider the usual Poisson problem for FEM $$-u''(x)=1 \quad x \in [0,1]$$ with homogeneous Dirichlet boundary conditions. The solution is $u(x)=-\frac{1}{2}x(x-1)$
I know that the FEM solution (I'm assuming linear elements) is exact at nodes, as noted also here
I implemented my code with constant step size $h$. Looking at internal nodes, the stiffness matrix has entry $$(A)_{ij}=\int \phi_i' \phi_j' dx$$ For $i =j$ (diagonal elements) I obtain $A_{ii}=2/h$, while the extradiagonal are $A_{i,i-1}=A_{i -1,i}=-1/h$ .
The load vector has entries $$(f)_i=(1,\phi_i)=h$$ In the end, I obtain the same matrix as with finite differences and hence I would expect second order. Why is exact solution at grid points recovered? (Modulo machine precision)?