The formula of the linear regression is,
where the coefficient $\beta_0$ is the intercept in the model. This can be written in matrix notation as,
$$y = X\beta+\varepsilon$$
where we are making a slight abuse of notation, because in order to include the $\beta_0$ in this formula, we are writing the vector
and we are writing the matrix
So if you want to implement a cost function for a linear regression model without intercept, you just need to remove $\beta_0$ from the vector $\beta$ and remove the vector $1$ from the matrix $X$.
Now, using the already available implementation of linear regression in
R, this can be done, as suggested in the comments, by setting
lm(cost ~ -1 + predictor1 + predictor2, data)
-1 there means that you do not want an intercept in the model. The result of this however is very different from the one you would obtain if you scale the data.
Scaling the data means that your data is centered, and the intercept of models built using centered data is $0$. In this case, you would obtain the same result with a non intercept model.
But if you build a model without an intercept in a dataset that is not scaled, you will force your regression line to go through the value (0,0), and then the result of a model with intercept and one without intercept will be different.