Let's say I have two samples. If I want to tell whether they are pulled from different populations, I can run a t-test. But let's say I want to test whether the samples are from the same population. How does one do this? That is, how do I calculate the statistical probability that these two samples were pulled from the same population?
The tests that compare distributions are rule-out tests. They start with the null hypothesis that the 2 populations are identical, then try to reject that hypothesis. We can never prove the null to be true, just reject it, so these tests cannot really be used to show that 2 samples come from the same population (or identical populations).
This is because there could be minor differences in the distributions (meaning they are not identical), but so small that tests cannot really find the difference.
Consider 2 distributions, the first is uniform from 0 to 1, the second is a mixture of 2 uniforms, so it is 1 between 0 and 0.999, and also 1 between 9.999 and 10 (0 elsewhere). So clearly these distributions are different (whether the difference is meaningful is another question), but if you take a sample size of 50 from each (total 100) there is over a 90% chance that you will only see values between 0 and 0.999 and be unable to see any real difference.
There are ways to do what is called equivalence testing where you ask if the 2 distributions/populations are equivalent, but you need to define what you consider to be equivalent. It is usually that some measure of difference is within a given range, i.e. the difference in the 2 means is less than 5% of the average of the 2 means, or the KS statistic is below a given cut-off, etc. If you can then calculate a confidence interval for the difference statistic (difference of means could just be the t confidence interval, bootstrapping, simulation, or other methods may be needed for other statistics). If the entire confidence interval falls in the "equivalence region" then we consider the 2 populations/distributions to be "equivalent".
The hard part is figuring out what the equivalence region should be.
Assuming your sample values come from continuous distributions, I would suggest the Kolmogorov-Smirnov test. It can be used to test whether two samples come from different distributions (this is how I am interpreting your usage of population) based on their associated empirical distributions.
Directly from Wikipedia:
The null distribution of this statistic is calculated under the null hypothesis that the samples are drawn from the same distribution (in the two-sample case)
The ks.test function in R can be used for this test.
While it is true the kstest does not test for homogeneity, I would argue that if you fail to reject with a large enough sample size (a high powered test), you can claim the differences are not practically significant. You could infer that if differences do exist, they are likely not meaningful (again, assuming large sample size). You cannot conclude they are from the same population as others have correctly stated. All this being said, typically I would just graphically examine the two samples for similarity.
You can use a 'shift function' which checks whether the 2 distributions differ at at each decile. While its technically a test of whether they are from different populations rather than the same, if the distributions don't differ on any of the deciles then you can be reasonably sure they are from the same population, especially if the group sizes are large.
I would also visualize the 2 groups: overlay their distributions and see if they resemble each other, or better yet draw a couple of thousand bootstrap samples from each group and plot those, as this would give you an idea of whether they come from the same population particularly if the population in question isnt normally distributed for you given variable.