Difference time series before Arima or within Arima Is it better to difference a series (assuming it needs it) before using an Arima OR better to use the d parameter within Arima?
I was surprised how different the fitted values are depending on which route is taken with the same model and data. Or am I doing something incorrectly?
install.packages("forecast")
library(forecast)

wineindT<-window(wineind, start=c(1987,1), end=c(1994,8))
wineindT_diff <-diff(wineindT)

#coefficients and other measures are similar
modA<-Arima(wineindT,order=c(1,1,0))
summary(modA)
modB<-Arima(wineindT_diff,order=c(1,0,0))
summary(modB)

#fitted values from modA
A<-forecast.Arima(modA,1)$fitted

#fitted from modB, setting initial value to the first value in the original series
B<-diffinv(forecast.Arima(modB,1)$fitted,xi=wineindT[1])


plot(A, col="red")
lines(B, col="blue")

ADD:
Please note I am differencing the series once and fitting arima (1,0,0) then I am fitting arima (1,1,0) to the original series. I am (I think) reversing the differencing on the fitted values for the arima(1,0,0) on the differenced file. 
I am comparing the fitted values - not the predictions.
Here is the plot (red is arima(1,1,0) and blue is the arima (1,0,0) on the differenced series after changing back to the original scale)  :

Response to Dr. Hyndman's Answer:
1) Can you illustrate in R code what I would need to do in order to get the two fitted values (and presumably forecasts) to match (allowing for small difference due to your first point in your answer) between Arima (1,1,0) and Arima(1,0,0) on the manually differenced series? I assume this has to do with the mean not being included in modA, but I am not entirely sure how to proceed.
2) Regarding your #3. I know I am missing the obvious, but are not $\hat{X}_t = X_{t-1} + \phi(X_{t-1}-X_{t-2}) $ and $\hat{Y}_t = \phi (X_{t-1}-X_{t-2})$ the same when $\hat{Y}_t$ is defined as $\hat{X}_t - X_{t-1}$? Are you saying I am "undifferencing" incorrectly?
 A: There are several issues here.


*

*If you difference first, then Arima() will fit a model to the differenced data. If you let Arima() do the differencing as part of the estimation procedure, it will use a diffuse prior for the initialization. This is explained in the help file for arima(). So the results will be different due to the different ways the initial observation is handled. I don't think it makes much difference in terms of the quality of the estimation. However, it is much easier to let Arima() handle the differencing if you want forecasts or fitted values on the original (undifferenced) data.

*Apart from differences in estimation, your two models are not equivalent because modB includes a constant while modA does not. By default, Arima() includes a constant when $d=0$ and no constant when $d>0$. You can over-ride these defaults with the include.mean argument.

*Fitted values for the original data are not equivalent to the undifferenced fitted values on the differenced data. To see this, note that the fitted values on the original data are given by
$$\hat{X}_t = X_{t-1} + \phi(X_{t-1}-X_{t-2})$$
whereas the fitted values on the differenced data are given by
$$\hat{Y}_t = \phi (X_{t-1}-X_{t-2})$$
where $\{X_t\}$ is the original time series and $\{Y_t\}$ is the differenced series. Thus $$\hat{X}_t - \hat{X}_{t-1} \ne \hat{Y}_t.$$
A: Sometimes you need to remove local means to make the series stationary. If the original series has an acf that doesn't die out this can be due to a level/step shift in the series. The remedy is to de-mean the series.
RESPONSE TO BOUNTY:
The way to get the same results/fitted values is after physically differencing the oroiginal (Y(t) series to get first difference (dely) , estimate an AR(1) without a constant.This is tantamount to fitting an OLS model of the form dely(t)= B1*dely(t-1) + a(t)  WITHOUT an intercept.The fitted values from this model, suitably integrated of order 1 will ( I believe ) give you the fitted values of a model; [1-B][AR(1)]Y(t)=a(t). Most pieces of software , with the noted exception of AUTOBOX will NOT ALLOW you to estimate an AR(1) model without a constant. Here is the equation for dely =+     [(1-  .675B* 1)]**-1  [A(T)]  while the equation for Y was
[(1-B*1)]Y(T) =+     [(1-  .676B* 1)]**-1  [A(T)] . Note the rounding error caused by the physical differencing of Y. Note that when differencing is in effect (in the model ) OR not  the user can select whether or not to include or to exclude the constant. Normal process is to include a constant for a stationary (i.e. undifferenced) ARIMA model and to optionally include a constant when differencing is in the model. It appears that the alternative approach (Arima) forces a constant into a stationary model which in my opinion has caused your dilemma.
A: I don't know why there would be a difference in the results unless somehow you are differencing more times one way than the other.  for an ARIMA(p,d,q)  the d differences are done first before any model fitting.  Then the stationary ARMA(p,q) model is fit to the differenced series.  The assumption is that after the removal of polynomial trends in the series the remaining series is stationary.  The number of differences corresponds to the order of teh polynomial that you want to remove.  So for a linear trend you just take one difference, for a quadratic trend you take two differences. I don't agree with most of what was said in John's answer.
A: One reason to difference an I(1) series is to make it stationary. Presuming you have the correct specification for the ARIMA model, the residuals to the model will have the autoregressive and moving average components removed and should be stationary. In that respect it can make sense to use the residuals to the model, rather than differencing. However, in circumstances where you have a lot of data that you think is approximately I(1), some people will just difference the data rather than estimate the ARIMA model wholly. The ARIMA model can fit a whole host of time series problems where it may not make sense to difference. For instance, if the data experiences mean-reversion, this may not always be appropriate to difference since it may not be I(1).
